diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/BddCreationHelper.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/BddCreationHelper.java index eb9400effb495dac3e185e07286fafa87c69f40b..6fe93f83fa3cdee25550c7d4f995a88beecd816c 100644 --- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/BddCreationHelper.java +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/BddCreationHelper.java @@ -21,6 +21,11 @@ import ttc2019.metamodels.bddg.Port; import ttc2019.metamodels.bddg.Subtree; import ttc2019.metamodels.bddg.Tree; +/** + * Generate for each BDD from Scala an identical one in Javas generated EMF format and save it in a file. + * + * @author Christopher Werner + */ public class BddCreationHelper { private BDD bdd; diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/BdtCreationHelper.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/BdtCreationHelper.java index 822fba1f4dcdfda3e1a231064873e6f2cc323763..ffb80bf92502e441744a7ba8487c98005024000e 100644 --- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/BdtCreationHelper.java +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/BdtCreationHelper.java @@ -21,6 +21,11 @@ import ttc2019.metamodels.bdd.Port; import ttc2019.metamodels.bdd.Subtree; import ttc2019.metamodels.bdd.Tree; +/** + * Generate for each BDT from Scala an identical one in Javas generated EMF format and save it in a file. + * + * @author Christopher Werner + */ public class BdtCreationHelper { private BDD bdd; diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java index 654cf1e9db4f1b1024c17697810ed1859531b6cd..3c1c2ead8b6cd48f7624b67c88886eea1253d822 100644 --- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/CreateTTinJava.java @@ -17,50 +17,50 @@ public class CreateTTinJava { 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); - } + truthttable = TTFactory.getTruthTable(name); + } public void createInputPort(String name, EObject id) { - ports.put(id, TTFactory.getInputPort(name)); - } + ports.put(id, TTFactory.getInputPort(name)); + } public void createOutputPort(String name, EObject id) { - ports.put(id, TTFactory.getOutputPort(name)); - } + ports.put(id, TTFactory.getOutputPort(name)); + } public void createRow(EObject id) { - rows.put(id, TTFactory.getRow()); - } + rows.put(id, TTFactory.getRow()); + } public void createCell(Boolean value, EObject id) { - cells.put(id, TTFactory.getCell(value)); - } + cells.put(id, TTFactory.getCell(value)); + } public void createTruthTableRowsRow(EObject tt, EObject row) { - Row r = rows.get(row); - truthttable.addRows(r); - r.setOwner(truthttable); - } + Row r = rows.get(row); + truthttable.addRows(r); + r.setOwner(truthttable); + } public void createTruthTablePortsPort(EObject tt, EObject port) { - Port p = ports.get(port); - truthttable.addPorts(p); - p.setOwner(truthttable); - } + Port p = ports.get(port); + truthttable.addPorts(p); + p.setOwner(truthttable); + } public void createRowCellsCell(EObject row, EObject cell) { - Cell c = cells.get(cell); - Row r = rows.get(row); - c.setOwner(r); - r.addCells(c); - } + Cell c = cells.get(cell); + Row r = rows.get(row); + c.setOwner(r); + r.addCells(c); + } public void createCellPortPort(EObject cell, EObject port) { - Cell c = cells.get(cell); - Port p = ports.get(port); - c.setPort(p); - p.addCells(c); - } + 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/LoadEObject.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java index f575bb5cc31edfb32bc63bedcdd50aabf687bb95..16a729982bddb3c2905c0c13be4b13b129202964 100644 --- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/LoadEObject.java @@ -17,8 +17,21 @@ import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl; import ttc2019.metamodels.tt.TTPackage; import ttc2019.metamodels.tt.TruthTable; +/** + * Load the EObject of an incoming Model in two different ways. + * Third time we load and EObject and cast it to a TruthTable. + * + * @author Christopher Werner + */ public class LoadEObject { + /** + * Simple loading of an EObject without extra Optimization stuff. + * @param pathMeta Path of metamodel + * @param pathInstance Path of model + * @return Instance of EObject + * @throws IOException + */ public EObject loadSimple(String pathMeta, String pathInstance) throws IOException { ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl()); @@ -32,6 +45,13 @@ public class LoadEObject { return ressourceModel.getContents().get(0); } + /** + * Loading an EObject with optimized settings. + * @param pathMeta Path of metamodel + * @param pathInstance Path of model + * @return Instance of EObject + * @throws IOException + */ public EObject loadOptimized(String pathMeta, String pathInstance) throws IOException { ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); @@ -51,6 +71,13 @@ public class LoadEObject { return ressourceModel.getContents().get(0); } + /** + * Load directly a truth table from the Java representation. + * @param pathMeta Path of metamodel + * @param pathInstance Path of model + * @return Instance of EObject + * @throws IOException + */ public TruthTable loadOptimizedTruthTable(String pathMeta, String pathInstance) throws IOException { TTPackage.eINSTANCE.getName(); ResourceSet rs = new ResourceSetImpl(); diff --git a/solutions/RSync/src/main/java/ttc2019/metamodels/create/TtCreationHelper.java b/solutions/RSync/src/main/java/ttc2019/metamodels/create/TtCreationHelper.java index 7e3a8d82054850d7c87d99a18590a3d64457c0ff..cfc4c13a34e5d03db82c553644384269da59a0ff 100644 --- a/solutions/RSync/src/main/java/ttc2019/metamodels/create/TtCreationHelper.java +++ b/solutions/RSync/src/main/java/ttc2019/metamodels/create/TtCreationHelper.java @@ -19,6 +19,11 @@ import ttc2019.metamodels.tt.Row; import ttc2019.metamodels.tt.TruthTable; import ttc2019.metamodels.tt.TTFactory; +/** + * Generate for each TT from Scala an identical one in Javas generated EMF format and save it in a file. + * + * @author Christopher Werner + */ public class TtCreationHelper { private TruthTable tt; diff --git a/solutions/RSync/src/main/scala/sum/bdd/Assignment.scala b/solutions/RSync/src/main/scala/sum/bdd/Assignment.scala deleted file mode 100644 index f7308648b0b99a8d845a5c5429240267fd9f5a27..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/Assignment.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.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/sum/bdd/AssignmentPortOutputPort.scala b/solutions/RSync/src/main/scala/sum/bdd/AssignmentPortOutputPort.scala deleted file mode 100644 index 5aa47a85765f385da12c1f88f2dd8c1e28124787..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/AssignmentPortOutputPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/BDD.scala b/solutions/RSync/src/main/scala/sum/bdd/BDD.scala deleted file mode 100644 index 51d40ceb58d7a4f4c719aebfe3624c0b72bcba56..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/BDD.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.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/sum/bdd/BDDPortsPort.scala b/solutions/RSync/src/main/scala/sum/bdd/BDDPortsPort.scala deleted file mode 100644 index 56dc04dbd13dc333f23769f101e9be846d0c22f7..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/BDDPortsPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/BDDTreeTree.scala b/solutions/RSync/src/main/scala/sum/bdd/BDDTreeTree.scala deleted file mode 100644 index 967ce08d1c039b895e29d7947e5b75572b96d29a..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/BDDTreeTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/HelperPort.scala b/solutions/RSync/src/main/scala/sum/bdd/HelperPort.scala deleted file mode 100644 index 4d2fd14f3e6c57844c608c1b27d24698af30883f..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/HelperPort.scala +++ /dev/null @@ -1,19 +0,0 @@ -package sum.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/sum/bdd/HelperTree.scala b/solutions/RSync/src/main/scala/sum/bdd/HelperTree.scala deleted file mode 100644 index d65b7d75c8bc68f0d95ed1612421c325c4181ddc..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/HelperTree.scala +++ /dev/null @@ -1,19 +0,0 @@ -package sum.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/sum/bdd/InputPort.scala b/solutions/RSync/src/main/scala/sum/bdd/InputPort.scala deleted file mode 100644 index 3a4f07882b0e3f9fae9187b5f469b93d4a0f2c1b..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/InputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.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/sum/bdd/Leaf.scala b/solutions/RSync/src/main/scala/sum/bdd/Leaf.scala deleted file mode 100644 index f92f42cf381468208e0566b5bb7cc838dc66d0b3..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/Leaf.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.bdd - -class Leaf extends Tree() { - - override def toString(): String = { - "Leaf:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/bdd/LeafAssignmentsAssignment.scala b/solutions/RSync/src/main/scala/sum/bdd/LeafAssignmentsAssignment.scala deleted file mode 100644 index cdb4e7eb4fcca22ea47c5b52a58286e279250454..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/LeafAssignmentsAssignment.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/OutputPort.scala b/solutions/RSync/src/main/scala/sum/bdd/OutputPort.scala deleted file mode 100644 index b535640ff4f7b0b03235d85fb7d4fb979f4f975a..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/OutputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.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/sum/bdd/Port.scala b/solutions/RSync/src/main/scala/sum/bdd/Port.scala deleted file mode 100644 index 5504ebdb527c37d9dff7741a6aba1ddb78f473d2..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/Port.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.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/sum/bdd/Subtree.scala b/solutions/RSync/src/main/scala/sum/bdd/Subtree.scala deleted file mode 100644 index 66a151fd468341a671b660962f3c50a4a8c68154..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/Subtree.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.bdd - -class Subtree extends Tree() { - - override def toString(): String = { - "Subtree:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/bdd/SubtreePortInputPort.scala b/solutions/RSync/src/main/scala/sum/bdd/SubtreePortInputPort.scala deleted file mode 100644 index 4d04a15421f57d723b96bb48e179745a27f0b040..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/SubtreePortInputPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/SubtreeTreeForOneTree.scala b/solutions/RSync/src/main/scala/sum/bdd/SubtreeTreeForOneTree.scala deleted file mode 100644 index b2a35878f8bcb341559f0bd70c39aae6380e9cdb..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/SubtreeTreeForOneTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/SubtreeTreeForZeroTree.scala b/solutions/RSync/src/main/scala/sum/bdd/SubtreeTreeForZeroTree.scala deleted file mode 100644 index f19d86993fe1dbd247668a1d897c4595f14098d8..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/SubtreeTreeForZeroTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/bdd/Tree.scala b/solutions/RSync/src/main/scala/sum/bdd/Tree.scala deleted file mode 100644 index b7edec9d75113511be36853adf8bbd6209782c0f..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bdd/Tree.scala +++ /dev/null @@ -1,15 +0,0 @@ -package sum.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/sum/bddg/Assignment.scala b/solutions/RSync/src/main/scala/sum/bddg/Assignment.scala deleted file mode 100644 index 34a216e12f895c780eb0258d90aa9d481d2f41c4..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/Assignment.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.bddg - -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/sum/bddg/AssignmentPortOutputPort.scala b/solutions/RSync/src/main/scala/sum/bddg/AssignmentPortOutputPort.scala deleted file mode 100644 index f6a29ebfad336069931f4d21f9be031e2d655660..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/AssignmentPortOutputPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -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/sum/bddg/BDD.scala b/solutions/RSync/src/main/scala/sum/bddg/BDD.scala deleted file mode 100644 index ce0f33c3e3cc1fe1a2b871d9c181cd3291de6e81..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/BDD.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.bddg - -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/sum/bddg/BDDPortsPort.scala b/solutions/RSync/src/main/scala/sum/bddg/BDDPortsPort.scala deleted file mode 100644 index 8efcda92bb6128ed210eb53abb2a6655654bd90c..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/BDDPortsPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -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/sum/bddg/BDDRootTree.scala b/solutions/RSync/src/main/scala/sum/bddg/BDDRootTree.scala deleted file mode 100644 index b213ff8840a9a066d0c5f65af2a3520485dff73f..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/BDDRootTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -import org.rosi_project.model_management.sum.compartments.IDirectAssoziation - -class BDDRootTree(private val sInstance: BDD, private val tInstance: Tree) extends IDirectAssoziation { - - override def internalInitialize(): Unit = { - this.source = new Source() - this.target = new Target() - sInstance play this.source - tInstance play this.target - } - - override def toString(): String = { - "[BDDRootTree " + source + ", " + target + "]" - } - - def getSourceIns(): BDD = { - return sInstance - } - - def getTargetIns(): Tree = { - return tInstance - } - - class Source extends IDirectAssoziationSource { - - override def toString(): String = { - "S: (" + sInstance + ")" - } - - } - - class Target extends IDirectAssoziationTarget { - - override def toString(): String = { - "T: (" + tInstance + ")" - } - - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/bddg/BDDTreesTree.scala b/solutions/RSync/src/main/scala/sum/bddg/BDDTreesTree.scala deleted file mode 100644 index 3c151b17e8c2d5175274db981f87c88f66b62ff1..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/BDDTreesTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -import org.rosi_project.model_management.sum.compartments.IComposition - -class BDDTreesTree(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 = { - "[BDDTreesTree " + 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/sum/bddg/HelperPort.scala b/solutions/RSync/src/main/scala/sum/bddg/HelperPort.scala deleted file mode 100644 index f9aa3dc740623a97fb19174aceb00e577ac57a90..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/HelperPort.scala +++ /dev/null @@ -1,19 +0,0 @@ -package sum.bddg - -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/sum/bddg/HelperTree.scala b/solutions/RSync/src/main/scala/sum/bddg/HelperTree.scala deleted file mode 100644 index c4b5e01b49cc5cdaf87f2038d7929342d50f85d9..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/HelperTree.scala +++ /dev/null @@ -1,19 +0,0 @@ -package sum.bddg - -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/sum/bddg/InputPort.scala b/solutions/RSync/src/main/scala/sum/bddg/InputPort.scala deleted file mode 100644 index 440bda70f1218fda4d51a12c7620df63d62243ee..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/InputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.bddg - -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/sum/bddg/Leaf.scala b/solutions/RSync/src/main/scala/sum/bddg/Leaf.scala deleted file mode 100644 index 6aaddfa5ba0aa3b5d9a4289416afcb17d908c475..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/Leaf.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.bddg - -class Leaf extends Tree() { - - override def toString(): String = { - "Leaf:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/bddg/LeafAssignmentsAssignment.scala b/solutions/RSync/src/main/scala/sum/bddg/LeafAssignmentsAssignment.scala deleted file mode 100644 index 69f44c423b2a000a0545359c6bf1996297647b35..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/LeafAssignmentsAssignment.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -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/sum/bddg/OutputPort.scala b/solutions/RSync/src/main/scala/sum/bddg/OutputPort.scala deleted file mode 100644 index 6055d6a09915a47d823c7d105e191e600a139fc8..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/OutputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.bddg - -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/sum/bddg/Port.scala b/solutions/RSync/src/main/scala/sum/bddg/Port.scala deleted file mode 100644 index e72a7eb308b2758bebac9d5a0ccaa19747e339d1..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/Port.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.bddg - -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/sum/bddg/Subtree.scala b/solutions/RSync/src/main/scala/sum/bddg/Subtree.scala deleted file mode 100644 index fe1a26c309ae71f5206b8a92095502f9ac4f96f4..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/Subtree.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.bddg - -class Subtree extends Tree() { - - override def toString(): String = { - "Subtree:" - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/bddg/SubtreePortInputPort.scala b/solutions/RSync/src/main/scala/sum/bddg/SubtreePortInputPort.scala deleted file mode 100644 index d0ee2195c18c483baeececcb7c5d3b6864430799..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/SubtreePortInputPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -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/sum/bddg/SubtreeTreeForOneTree.scala b/solutions/RSync/src/main/scala/sum/bddg/SubtreeTreeForOneTree.scala deleted file mode 100644 index f69633987c38eb85c9d7b1b8691fc79f96fce9aa..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/SubtreeTreeForOneTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -import org.rosi_project.model_management.sum.compartments.IAssociation - -class SubtreeTreeForOneTree(private val sInstance: Subtree, private val tInstance: Tree) 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 = { - "[SubtreeTreeForOneTree " + source + ", " + target + "]" - } - - def getSourceIns(): Subtree = { - return sInstance - } - - def getTargetIns(): Tree = { - 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/sum/bddg/SubtreeTreeForZeroTree.scala b/solutions/RSync/src/main/scala/sum/bddg/SubtreeTreeForZeroTree.scala deleted file mode 100644 index 381b9e2a2622889723a49868c66673add40d7de6..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/SubtreeTreeForZeroTree.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.bddg - -import org.rosi_project.model_management.sum.compartments.IAssociation - -class SubtreeTreeForZeroTree(private val sInstance: Subtree, private val tInstance: Tree) 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 = { - "[SubtreeTreeForZeroTree " + source + ", " + target + "]" - } - - def getSourceIns(): Subtree = { - return sInstance - } - - def getTargetIns(): Tree = { - 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/sum/bddg/Tree.scala b/solutions/RSync/src/main/scala/sum/bddg/Tree.scala deleted file mode 100644 index d8b8dad938efd5846dd3c7497754c556d7602e30..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/bddg/Tree.scala +++ /dev/null @@ -1,15 +0,0 @@ -package sum.bddg - -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/sum/tt/Cell.scala b/solutions/RSync/src/main/scala/sum/tt/Cell.scala deleted file mode 100644 index 7a36bd89388ba7c4aaaca7ef799a13c78a7c5027..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/Cell.scala +++ /dev/null @@ -1,22 +0,0 @@ -package sum.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/sum/tt/CellPortPort.scala b/solutions/RSync/src/main/scala/sum/tt/CellPortPort.scala deleted file mode 100644 index 5b72bf69bab2e36c3ae2269dcf179c11dfbc9c3f..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/CellPortPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/tt/HelperPort.scala b/solutions/RSync/src/main/scala/sum/tt/HelperPort.scala deleted file mode 100644 index c2a0d0f0f55be058ede01b16fc0fcd227185e18b..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/HelperPort.scala +++ /dev/null @@ -1,19 +0,0 @@ -package sum.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/sum/tt/InputPort.scala b/solutions/RSync/src/main/scala/sum/tt/InputPort.scala deleted file mode 100644 index bfa2224c5137a1fc97824fd9345faf2cc9f5ad4d..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/InputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.tt - -class InputPort(p_Name: String, p_Location: String) extends Port(p_Name, p_Location) { - - override def toString(): String = { - "InputPort:" + " name=" + name + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/tt/LocatedElement.scala b/solutions/RSync/src/main/scala/sum/tt/LocatedElement.scala deleted file mode 100644 index ab5d1da8340821db0ba8783d4668b70caf407bfd..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/LocatedElement.scala +++ /dev/null @@ -1,24 +0,0 @@ -package sum.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/sum/tt/OutputPort.scala b/solutions/RSync/src/main/scala/sum/tt/OutputPort.scala deleted file mode 100644 index 4ef53af1fcfd273dbf368a52afe0d5129ebfad91..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/OutputPort.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.tt - -class OutputPort(p_Name: String, p_Location: String) extends Port(p_Name, p_Location) { - - override def toString(): String = { - "OutputPort:" + " name=" + name + " location=" + location - } - -} - - - - \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/sum/tt/Port.scala b/solutions/RSync/src/main/scala/sum/tt/Port.scala deleted file mode 100644 index 59a6129efa2f556d71b6597cda737c1d62174235..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/Port.scala +++ /dev/null @@ -1,22 +0,0 @@ -package sum.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/sum/tt/Row.scala b/solutions/RSync/src/main/scala/sum/tt/Row.scala deleted file mode 100644 index 707431f9eccef2a14cf1d40fa3e0a8a11e2d7e7f..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/Row.scala +++ /dev/null @@ -1,13 +0,0 @@ -package sum.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/sum/tt/RowCellsCell.scala b/solutions/RSync/src/main/scala/sum/tt/RowCellsCell.scala deleted file mode 100644 index f929e5b54ce3985c2a7fd9777e4ebb26a8eae3af..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/RowCellsCell.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/tt/TruthTable.scala b/solutions/RSync/src/main/scala/sum/tt/TruthTable.scala deleted file mode 100644 index 4663a30f8647c3506a87e6e35d863db262add93b..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/TruthTable.scala +++ /dev/null @@ -1,22 +0,0 @@ -package sum.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/sum/tt/TruthTablePortsPort.scala b/solutions/RSync/src/main/scala/sum/tt/TruthTablePortsPort.scala deleted file mode 100644 index ed70cc2e604519e6ee5884f4e640c47f8c84fe92..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/TruthTablePortsPort.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sum/tt/TruthTableRowsRow.scala b/solutions/RSync/src/main/scala/sum/tt/TruthTableRowsRow.scala deleted file mode 100644 index 1d9ed647fad685358018be9338416411260a6ca9..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/sum/tt/TruthTableRowsRow.scala +++ /dev/null @@ -1,46 +0,0 @@ -package sum.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/sync/bdd/Assignment.scala b/solutions/RSync/src/main/scala/sync/bdd/Assignment.scala index 26c55d68d713dc3b369f541d484ada4af49287fb..b08405c8b10eb2cc413c904afa75388b38181d09 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 setValue () + +this syncSetValue () } 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 setOwner () + +this syncSetOwner () } 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 setPort () + +this syncSetPort () } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bdd/BDD.scala b/solutions/RSync/src/main/scala/sync/bdd/BDD.scala index d95f461eb06ddd4c604d34f17fca5a346bd12d62..671c46fd7c9adc2d20f04e34558107ed491aae68 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 setName () + +this syncSetName () } def getTree(): Tree = { @@ -19,7 +19,7 @@ class BDD(protected var name: String, protected var tree: Tree, protected var po def setTree(t: Tree): Unit = { tree = t - +this setTree () + +this syncSetTree () } def getPorts(): Set[Port] = { @@ -28,12 +28,12 @@ class BDD(protected var name: String, protected var tree: Tree, protected var po def addPorts(p: Port): Unit = { ports += p - +this addPorts () + +this syncAddPorts (p) } def removePorts(p: Port): Unit = { ports -= p - +this removePorts () + +this syncRemovePorts (p) } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala b/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala index eb25fb9c5f84d63eb8009a8534e8444a8660ce7c..30412c321b2a5bc4be1d45cb057f717005f732a4 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/InputPort.scala @@ -8,12 +8,12 @@ class InputPort(protected var subtrees: Set[Subtree], p_Name: String, p_Owner: B def addSubtrees(s: Subtree): Unit = { subtrees += s - +this addSubtrees () + +this syncAddSubtrees (s) } def removeSubtrees(s: Subtree): Unit = { subtrees -= s - +this removeSubtrees () + +this syncRemoveSubtrees (s) } 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 83a8dc37093c939e8506704ab59ddbc095c33618..4098c87025e9ebe99ab60ff938154db311532962 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/Leaf.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/Leaf.scala @@ -8,23 +8,17 @@ class Leaf(protected var assignments: Set[Assignment], t_OwnerSubtreeForOne: Sub def addAssignments(a: Assignment): Unit = { assignments += a - +this addAssignments () + +this syncAddAssignments (a) } def removeAssignments(a: Assignment): Unit = { assignments -= a - +this removeAssignments () + +this syncRemoveAssignments (a) } 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/bdd/OutputPort.scala b/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala index 3c20131ddc541d69366cc77b3844574253357159..2ac3801ad3df2f9bc2249b5ecaeda866ce17f27b 100644 --- a/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bdd/OutputPort.scala @@ -8,12 +8,12 @@ class OutputPort(protected var assignments: Set[Assignment], p_Name: String, p_O def addAssignments(a: Assignment): Unit = { assignments += a - +this addAssignments () + +this syncAddAssignments (a) } def removeAssignments(a: Assignment): Unit = { assignments -= a - +this removeAssignments () + +this syncRemoveAssignments (a) } 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 0d1e39580fd4716f82b6c7ee3dd8914992a6731b..9c812081fb672e13d1054c4738d055acebeb5595 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 setName () + +this syncSetName () } 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 setOwner () + +this syncSetOwner () } 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 83e197d903259479e66c7e178f43216a72af09a1..d5e69347be8a1b7d55c9ae4ec0ae439e554d7aa2 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 setTreeForOne () + +this syncSetTreeForOne () } 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 setTreeForZero () + +this syncSetTreeForZero () } def getPort(): InputPort = { @@ -26,33 +26,23 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setPort(p: InputPort): Unit = { port = p - +this setPort () + +this syncSetPort () } 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 + + override def getAvgPath(): Double = { + return 0.5 * (treeForOne.getAvgPath() + treeForZero.getAvgPath()) + 1 + } + + override def getMinPath(): Int = { + Math.min(treeForZero.getMinPath(), treeForOne.getMinPath()) + 1 + } + + override def getMaxPath(): Int = { + Math.max(treeForZero.getMaxPath(), treeForOne.getMaxPath()) + 1 } } diff --git a/solutions/RSync/src/main/scala/sync/bdd/Tree.scala b/solutions/RSync/src/main/scala/sync/bdd/Tree.scala index a1d257663b7246d8d2bc5a73302a02e67e41972b..9a6faeaae3dd21cfd833ff5f93fa3c292d3fe267 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 setOwnerSubtreeForOne () + +this syncSetOwnerSubtreeForOne () } 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 setOwnerSubtreeForZero () + +this syncSetOwnerSubtreeForZero () } def getOwnerBDD(): BDD = { @@ -28,18 +28,18 @@ abstract class Tree(protected var ownerSubtreeForOne: Subtree, protected var own def setOwnerBDD(o: BDD): Unit = { ownerBDD = o - +this setOwnerBDD () + +this syncSetOwnerBDD () } override def toString(): String = { "Tree:" } - - def getAvgPath(): Double - - def getMinPath(): Int - - def getMaxPath(): Int + + def getAvgPath(): Double = 0.0 + + def getMinPath(): Int = 0 + + def getMaxPath(): Int = 0 } diff --git a/solutions/RSync/src/main/scala/sync/bddg/Assignment.scala b/solutions/RSync/src/main/scala/sync/bddg/Assignment.scala index 2a601fbea986c17e788b56385dfeabf95ecf0962..4008da2917d153283b8c0fe1e104592f57eef359 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 setValue () + +this syncSetValue () } 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 setOwner () + +this syncSetOwner () } 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 setPort () + +this syncSetPort () } 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 fe5faa503c56a27ec48a4f422c3280189c82bdc6..db65c99d9617e77f5bc8900ba6406cb7de306775 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/BDD.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/BDD.scala @@ -10,7 +10,7 @@ class BDD(protected var name: String, protected var trees: Set[Tree], protected def setName(n: String): Unit = { name = n - +this setName () + +this syncSetName () } def getTrees(): Set[Tree] = { @@ -19,12 +19,12 @@ class BDD(protected var name: String, protected var trees: Set[Tree], protected def addTrees(t: Tree): Unit = { trees += t - +this addTrees () + +this syncAddTrees (t) } def removeTrees(t: Tree): Unit = { trees -= t - +this removeTrees () + +this syncRemoveTrees (t) } def getRoot(): Tree = { @@ -33,7 +33,7 @@ class BDD(protected var name: String, protected var trees: Set[Tree], protected def setRoot(r: Tree): Unit = { root = r - +this setRoot () + +this syncSetRoot () } def getPorts(): Set[Port] = { @@ -42,12 +42,12 @@ class BDD(protected var name: String, protected var trees: Set[Tree], protected def addPorts(p: Port): Unit = { ports += p - +this addPorts () + +this syncAddPorts (p) } def removePorts(p: Port): Unit = { ports -= p - +this removePorts () + +this syncRemovePorts (p) } 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 8ed8b91fb96ab80963c65f6728a10cfaecef1e07..26772fe2ee5ed0578e86417b683e59d3ec146cb4 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/InputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/InputPort.scala @@ -8,12 +8,12 @@ class InputPort(protected var subtrees: Set[Subtree], p_Name: String, p_Owner: B def addSubtrees(s: Subtree): Unit = { subtrees += s - +this addSubtrees () + +this syncAddSubtrees (s) } def removeSubtrees(s: Subtree): Unit = { subtrees -= s - +this removeSubtrees () + +this syncRemoveSubtrees (s) } 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 570ea43e9303f3559871f693a710b2354961f846..4295556d6ca60c46ead25cfe7ed53cd53d97d4c7 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Leaf.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Leaf.scala @@ -8,23 +8,17 @@ class Leaf(protected var assignments: Set[Assignment], t_OwnerSubtreeForOne: Set def addAssignments(a: Assignment): Unit = { assignments += a - +this addAssignments () + +this syncAddAssignments (a) } def removeAssignments(a: Assignment): Unit = { assignments -= a - +this removeAssignments () + +this syncRemoveAssignments (a) } 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 80a71d11b017645cfd9c009bc5b349ccdc08b345..3b12cc76e9beefada508fe4e8cf70bdfcfc3270f 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/OutputPort.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/OutputPort.scala @@ -8,12 +8,12 @@ class OutputPort(protected var assignments: Set[Assignment], p_Name: String, p_O def addAssignments(a: Assignment): Unit = { assignments += a - +this addAssignments () + +this syncAddAssignments (a) } def removeAssignments(a: Assignment): Unit = { assignments -= a - +this removeAssignments () + +this syncRemoveAssignments (a) } 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 a2cf2db82a38942e1f7b2b089a0a8101a26c8468..70a5205580b967e468ffb7e4e3684b683095fce5 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 setName () + +this syncSetName () } 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 setOwner () + +this syncSetOwner () } 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 d8822bac7908801e0e5fae0d56e55d1142a3fc4a..c83d3ed7179aaf9298c0d3f2920069e1bc059925 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 setTreeForOne () + +this syncSetTreeForOne () } 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 setTreeForZero () + +this syncSetTreeForZero () } def getPort(): InputPort = { @@ -26,33 +26,23 @@ class Subtree(protected var treeForOne: Tree, protected var treeForZero: Tree, p def setPort(p: InputPort): Unit = { port = p - +this setPort () + +this syncSetPort () } override def toString(): String = { "Subtree:" } - def getAvgPath(): Double = { - return 0.5 * treeForOne.getAvgPath() + 0.5 * treeForZero.getAvgPath() + 1 + override def getAvgPath(): Double = { + return 0.5 * (treeForOne.getAvgPath() + treeForZero.getAvgPath()) + 1 } - - def getMinPath(): Int = { - val minZero = treeForZero.getMinPath() - val minOne = treeForOne.getMinPath() - if (minZero < minOne) { - return minZero + 1 - } - return minOne + 1 + + override def getMinPath(): Int = { + Math.min(treeForZero.getMinPath(), treeForOne.getMinPath()) + 1 } - - def getMaxPath(): Int = { - val maxZero = treeForZero.getMaxPath() - val maxOne = treeForOne.getMaxPath() - if (maxZero > maxOne) { - return maxZero + 1 - } - return maxOne + 1 + + override def getMaxPath(): Int = { + Math.max(treeForZero.getMaxPath(), treeForOne.getMaxPath()) + 1 } } diff --git a/solutions/RSync/src/main/scala/sync/bddg/Tree.scala b/solutions/RSync/src/main/scala/sync/bddg/Tree.scala index cf5f0371470903d6775e01741884420bc38956bc..a022da7a9420c63e010df2502d603c12da737757 100644 --- a/solutions/RSync/src/main/scala/sync/bddg/Tree.scala +++ b/solutions/RSync/src/main/scala/sync/bddg/Tree.scala @@ -10,12 +10,12 @@ abstract class Tree(protected var ownerSubtreeForOne: Set[Subtree], protected va def addOwnerSubtreeForOne(o: Subtree): Unit = { ownerSubtreeForOne += o - +this addOwnerSubtreeForOne () + +this syncAddOwnerSubtreeForOne (o) } def removeOwnerSubtreeForOne(o: Subtree): Unit = { ownerSubtreeForOne -= o - +this removeOwnerSubtreeForOne () + +this syncRemoveOwnerSubtreeForOne (o) } def getOwnerSubtreeForZero(): Set[Subtree] = { @@ -24,12 +24,12 @@ abstract class Tree(protected var ownerSubtreeForOne: Set[Subtree], protected va def addOwnerSubtreeForZero(o: Subtree): Unit = { ownerSubtreeForZero += o - +this addOwnerSubtreeForZero () + +this syncAddOwnerSubtreeForZero (o) } def removeOwnerSubtreeForZero(o: Subtree): Unit = { ownerSubtreeForZero -= o - +this removeOwnerSubtreeForZero () + +this syncRemoveOwnerSubtreeForZero (o) } def getOwnerBDD(): BDD = { @@ -38,18 +38,18 @@ abstract class Tree(protected var ownerSubtreeForOne: Set[Subtree], protected va def setOwnerBDD(o: BDD): Unit = { ownerBDD = o - +this setOwnerBDD () + +this syncSetOwnerBDD () } override def toString(): String = { "Tree:" } - - def getAvgPath(): Double - - def getMinPath(): Int - - def getMaxPath(): Int + + def getAvgPath(): Double = 0.0 + + def getMinPath(): Int = 0 + + def getMaxPath(): Int = 0 } diff --git a/solutions/RSync/src/main/scala/sync/tt/Cell.scala b/solutions/RSync/src/main/scala/sync/tt/Cell.scala index 6e07c8be975520de257d6101a72c3c03ef83c1c4..2898978d962c5ebb3d04d0cd2e3955d6fa093c77 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 = null, protected var owner: Row = null, l_Location: String = null) extends LocatedElement(l_Location) { +class Cell(protected var value: Boolean, protected var port: Port, protected var owner: Row, l_Location: String) extends LocatedElement(l_Location) { def getValue(): Boolean = { value @@ -8,7 +8,7 @@ class Cell(protected var value: Boolean, protected var port: Port = null, protec def setValue(v: Boolean): Unit = { value = v - +this setValue () + +this syncSetValue () } def getPort(): Port = { @@ -17,7 +17,7 @@ class Cell(protected var value: Boolean, protected var port: Port = null, protec def setPort(p: Port): Unit = { port = p - +this setPort () + +this syncSetPort () } def getOwner(): Row = { @@ -26,7 +26,7 @@ class Cell(protected var value: Boolean, protected var port: Port = null, protec def setOwner(o: Row): Unit = { owner = o - +this setOwner () + +this syncSetOwner () } 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 e174f308d8c240a60c35b6d1f393cbb36fba2893..c59295b45112175387710cf5414bec975af9f60f 100644 --- a/solutions/RSync/src/main/scala/sync/tt/InputPort.scala +++ b/solutions/RSync/src/main/scala/sync/tt/InputPort.scala @@ -1,8 +1,6 @@ package sync.tt -//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) { +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) { 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 03c08a88bca53129442dde4f3907fdb4a5ac037b..ab22829d0b5e3eb69e53991c0ffdca668ec712c1 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 setLocation () + +this syncSetLocation () } 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 0c7244e51894b0bffa55503e197ae44fd957ca71..b8543a73f1bb2759eedebc3cbb97b71177f7811b 100644 --- a/solutions/RSync/src/main/scala/sync/tt/OutputPort.scala +++ b/solutions/RSync/src/main/scala/sync/tt/OutputPort.scala @@ -1,8 +1,6 @@ package sync.tt -//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) { +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) { 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 86b0c0e20ca7570ee56850d55bd1e88da79657ea..89522cf07b961e0fdd2745670b00be7b0f2efbe0 100644 --- a/solutions/RSync/src/main/scala/sync/tt/Port.scala +++ b/solutions/RSync/src/main/scala/sync/tt/Port.scala @@ -1,7 +1,5 @@ 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 = { @@ -10,7 +8,7 @@ abstract class Port(protected var name: String, protected var cells: Set[Cell], def setName(n: String): Unit = { name = n - +this setName () + +this syncSetName () } def getCells(): Set[Cell] = { @@ -19,12 +17,12 @@ abstract class Port(protected var name: String, protected var cells: Set[Cell], def addCells(c: Cell): Unit = { cells += c - +this addCells () + +this syncAddCells (c) } def removeCells(c: Cell): Unit = { cells -= c - +this removeCells () + +this syncRemoveCells (c) } def getOwner(): TruthTable = { @@ -33,7 +31,7 @@ abstract class Port(protected var name: String, protected var cells: Set[Cell], def setOwner(o: TruthTable): Unit = { owner = o - +this setOwner () + +this syncSetOwner () } 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 d798038f4db213b997b94a564bb24ba41dee0cc3..517b5a0324fffc9514278d1f315bebd220093887 100644 --- a/solutions/RSync/src/main/scala/sync/tt/Row.scala +++ b/solutions/RSync/src/main/scala/sync/tt/Row.scala @@ -1,7 +1,5 @@ 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] = { @@ -10,12 +8,12 @@ class Row(protected var cells: Set[Cell], protected var owner: TruthTable, l_Loc def addCells(c: Cell): Unit = { cells += c - +this addCells () + +this syncAddCells (c) } def removeCells(c: Cell): Unit = { cells -= c - +this removeCells () + +this syncRemoveCells (c) } def getOwner(): TruthTable = { @@ -24,7 +22,7 @@ class Row(protected var cells: Set[Cell], protected var owner: TruthTable, l_Loc def setOwner(o: TruthTable): Unit = { owner = o - +this setOwner () + +this syncSetOwner () } 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 a81ee219eb42cd77c2ebd946510d3fa08f0bb96b..4ebdec512e45a21b9f04d2a3b15aa7688d1394bb 100644 --- a/solutions/RSync/src/main/scala/sync/tt/TruthTable.scala +++ b/solutions/RSync/src/main/scala/sync/tt/TruthTable.scala @@ -1,7 +1,5 @@ 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 = { @@ -10,7 +8,7 @@ class TruthTable(protected var name: String, protected var rows: Set[Row], prote def setName(n: String): Unit = { name = n - +this setName () + +this syncSetName () } def getRows(): Set[Row] = { @@ -19,12 +17,12 @@ class TruthTable(protected var name: String, protected var rows: Set[Row], prote def addRows(r: Row): Unit = { rows += r - +this addRows () + +this syncAddRows (r) } def removeRows(r: Row): Unit = { rows -= r - +this removeRows () + +this syncRemoveRows (r) } def getPorts(): Set[Port] = { @@ -33,12 +31,12 @@ class TruthTable(protected var name: String, protected var rows: Set[Row], prote def addPorts(p: Port): Unit = { ports += p - +this addPorts () + +this syncAddPorts (p) } def removePorts(p: Port): Unit = { ports -= p - +this removePorts () + +this syncRemovePorts (p) } override def toString(): String = { diff --git a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala index 2213170ca1b43b3100cfb41363481f649d907d2e..65ac8be3a575ed9eca0abac50ac7cd392d2f6094 100644 --- a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala +++ b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala @@ -6,12 +6,12 @@ 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._ import ttc2019.metamodels.create.Launcher -/** The `CompleteTTCProcess` executes the entire transformation workflow. Its methods are inspired - * by the different phases that the benchmark is expecting. - */ +/** + * The `CompleteTTCProcess` executes the entire transformation workflow. Its methods are inspired + * by the different phases that the benchmark is expecting. + */ object CompleteTTCProcess extends App { SynchronizationCompartment combine RsumCompartment @@ -25,74 +25,78 @@ object CompleteTTCProcess extends App { var processConfig: TTCProcessConfiguration = _ var bdt: Boolean = _ - /** Performs necessary setup instructions such as loading the ecore meta-model. - * - * @param processConfig contains the necessary file locations - */ + /** + * Performs necessary setup instructions such as loading the ecore meta-model. + * + * @param processConfig contains the necessary file locations + */ def initialize(processConfig: TTCProcessConfiguration): Unit = { - val sync = true bdt = processConfig.processMode == ProcessMode.BDT || processConfig.processMode == ProcessMode.BDTU loader = new TTCLoader validator = new Launcher - if (sync) { - ctts = new CreateTruthTableSync() - if (bdt) { - integrate = if (processConfig.processMode == ProcessMode.BDT) BdtSyncIntegration else BdtSyncIntegrationWithoutOrder - writeOut = WriteSyncBdtOutput - } else { - integrate = if (processConfig.processMode == ProcessMode.BDD) BddSyncIntegration else BddSyncIntegrationWithoutOrder - writeOut = WriteSyncBddOutput - } + ctts = new CreateTruthTableSync() + if (bdt) { + integrate = if (processConfig.processMode == ProcessMode.BDT) BdtSyncIntegration else BdtSyncIntegrationWithoutOrder + writeOut = WriteSyncBdtOutput } else { - ctts = new CreateTruthTableSum() - integrate = BdtSumIntegration - writeOut = WriteSumBdtOutput + integrate = if (processConfig.processMode == ProcessMode.BDD) BddSyncIntegration else BddSyncIntegrationWithoutOrder + writeOut = WriteSyncBddOutput } this.processConfig = processConfig saver = loader.javaOptimizedTTJavaEcore(processConfig.ttEcoreName, processConfig.ttFileName) } - /** Loads the truth table. - */ + /** + * Loads the truth table. + */ def load(): Unit = loader.createTruthTableRSYNCInstance(saver, ctts) - /** Transforms the truth table instance to a binary decision diagram. - */ + /** + * Transforms the truth table instance to a binary decision diagram. + */ def run(): Unit = SynchronizationCompartment.integrateNewModel(integrate) - /** Shows all created TT and BDD elements '''after transformation'''. - */ + /** + * Shows all created TT and BDD elements '''after transformation'''. + */ def printModelElements(): Unit = ModelElementLists.printFromPackage("sync.bdd.BDD") - /** Persists the BDD in the File system (according to the - * [[TTCProcessConfiguration process configuration]] specified during - * [[initialize() initialization]] '''after transformation'''. - */ + /** + * Persists the BDD in the File system (according to the + * [[TTCProcessConfiguration process configuration]] specified during + * [[initialize() initialization]] '''after transformation'''. + */ def doWriteOut(): Unit = writeOut.generateEverything(processConfig.bddFileName) - - /** Checks, whether the generated BDD and the original TT work as expected (after - * transformation!). - */ + /** + * Checks, whether the generated BDD and the original TT work as expected (after + * transformation!). + */ def validateModelEquality(): Unit = validator.launch(processConfig.ttFileName, processConfig.bddFileName) - /** Runs the entire transformation process at once. - * - * That is initialization, loading and running as the core part, as well as printing the model, - * writing the generated BDD and validating as extensions of the minimal workflow will be - * executed. - */ + /** + * Runs the entire transformation process at once. + * + * That is initialization, loading and running as the core part, as well as printing the model, + * writing the generated BDD and validating as extensions of the minimal workflow will be + * executed. + */ def executeEntireProcess(processConfig: TTCProcessConfiguration): Unit = { initialize(processConfig) load() run() - printModelElements() - doWriteOut() + //printModelElements() + if (processConfig.processMode == ProcessMode.BDT || processConfig.processMode == ProcessMode.BDTU) { + MetricMeasurement.printMetricsBDT(true) + } else { + MetricMeasurement.printMetricsBDD(true) + } + doWriteOut() validateModelEquality() } override def main(args: Array[String]): Unit = { - val processConfig = TTCProcessConfiguration(ttFileName = "TT.ttmodel", bddFileName = "Generated.bddmodel", processMode = ProcessMode.BDT) + val processConfig = TTCProcessConfiguration(ttFileName = "TT.ttmodel", bddFileName = "Generated.bddmodel", processMode = ProcessMode.BDDU) executeEntireProcess(processConfig) } diff --git a/solutions/RSync/src/main/scala/ttc2019/worksum/BdtSumIntegration.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/BdtSumIntegration.scala deleted file mode 100644 index c0274261a1541946101b4a55eabb867fbcf4bc27..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/BdtSumIntegration.scala +++ /dev/null @@ -1,475 +0,0 @@ -package ttc2019.worksum - -import org.rosi_project.model_management.core._ -import org.rosi_project.model_management.sync.IIntegrationCompartment -import org.rosi_project.model_management.sync.roles.IIntegrator -import org.rosi_project.model_management.sync.roles.IRoleManager -import org.rosi_project.model_management.sum.compartments.IRelationCompartment -import org.rosi_project.model_management.sum.roles.IRelationRole - -import sum.tt.TruthTable -import sum.tt.Row -import sum.tt.Cell -import sum.tt.CellPortPort -import sum.tt.RowCellsCell -import sum.tt.TruthTablePortsPort -import sum.tt.TruthTableRowsRow -import sum.bdd.BDD -import sum.bdd.Leaf -import sum.bdd.Assignment -import sum.bdd.Subtree -import sum.bdd.Tree -import sum.bdd.BDDPortsPort -import sum.bdd.AssignmentPortOutputPort -import sum.bdd.LeafAssignmentsAssignment -import sum.bdd.BDDTreeTree -import sum.bdd.SubtreePortInputPort -import sum.bdd.SubtreeTreeForOneTree -import sum.bdd.SubtreeTreeForZeroTree - -object BdtSumIntegration extends IIntegrationCompartment { - - private var createdObjects: Set[PlayerSync] = Set.empty - - def getRelationalIntegratorsForClassName(classname: Object): IIntegrator = { - if (classname.isInstanceOf[TruthTablePortsPort]) - return new TruthTablePortsPortConstruct() - //if (classname.isInstanceOf[CellPortPort]) - // return new CellPortPortConstruct() - return null - } - - def getIntegratorForClassName(classname: Object): IIntegrator = { - if (classname.isInstanceOf[TruthTable]) - return new TruthTableConstruct() - if (classname.isInstanceOf[sum.tt.OutputPort]) - return new OutputPortConstruct() - if (classname.isInstanceOf[sum.tt.InputPort]) - return new InputPortConstruct() - return null - } - - def printPretty(indent: String, tree: Tree, number: String, last: Boolean) { - var name = "" - ModelElementLists.getElementsFromType("SubtreePortInputPort").filter(spi => spi.asInstanceOf[SubtreePortInputPort].getSourceIns() == tree).foreach(spi => { - name = spi.asInstanceOf[SubtreePortInputPort].getTargetIns().getName() - }) - if (name == "") { - ModelElementLists.getElementsFromType("LeafAssignmentsAssignment").filter(spi => spi.asInstanceOf[LeafAssignmentsAssignment].getSourceIns() == tree).foreach(spi => { - name += spi.asInstanceOf[LeafAssignmentsAssignment].getTargetIns().getValue() + " " - }) - } - var ini = indent - print(ini); - if (last) { - print("\\-") - ini += " " - } else { - print("|-"); - ini += "| "; - } - println(number + " " + name); - - ModelElementLists.getElementsFromType("SubtreeTreeForZeroTree").filter(spi => spi.asInstanceOf[SubtreeTreeForZeroTree].getSourceIns() == tree).foreach( - spi => printPretty(ini, spi.asInstanceOf[SubtreeTreeForZeroTree].getTargetIns(), "0", false)) - ModelElementLists.getElementsFromType("SubtreeTreeForOneTree").filter(spi => spi.asInstanceOf[SubtreeTreeForOneTree].getSourceIns() == tree).foreach( - spi => printPretty(ini, spi.asInstanceOf[SubtreeTreeForOneTree].getTargetIns(), "1", true)) - } - - def printManager(): Unit = { - createdObjects.foreach(obj => { - println(obj.getClass.getName) - //if (obj.isInstanceOf[sync.bdd.Assignment]) { - +obj printAllManager () - //} - }) - } - - def finalEditFunction(): Unit = { - println("FINISH FUNCTION") - var bddNode: BDD = null - var ttNode: TruthTable = null - - createdObjects.filter(_.isInstanceOf[BDD]).foreach(b => bddNode = b.asInstanceOf[BDD]) - val oppBDD: PlayerSync = +bddNode getRelatedClassFromName ("TruthTable") - if (oppBDD != null) { - ttNode = oppBDD.asInstanceOf[TruthTable] - } - val rows = ModelElementLists.getElementsFromType("TruthTableRowsRow").filter(ttr => ttr.asInstanceOf[TruthTableRowsRow].getSourceIns() == ttNode).map(ttr => ttr.asInstanceOf[TruthTableRowsRow].getTargetIns()) - - val tree = createOutputSubtree(rows.toSet, Set.empty) - //val tree = createInputSubtree(rows.toSet, Set.empty) - val btt = new BDDTreeTree(bddNode, tree) - btt.initialize() - createdObjects += btt - - printPretty("", tree, "", true) - printManager() - - println("END FINISH FUNCTION") - } - - def createOutputSubtree(rows: Set[Row], finishPorts: Set[sum.tt.InputPort]): Tree = { - var numberTrue = -1 - var numberFalse = -1 - var max = 0 - var portTT: sum.tt.InputPort = null - var portBDD: sum.bdd.InputPort = null - var cellis: Set[Cell] = Set.empty - - createdObjects.filter(_.isInstanceOf[sum.bdd.InputPort]).foreach(bddip => { - val oppo: PlayerSync = +bddip getRelatedClassFromName ("InputPort") - if (oppo != null) { - val ttip = oppo.asInstanceOf[sum.tt.InputPort] - if (!finishPorts.contains(ttip)) { - val cellPorts = ModelElementLists.getElementsFromType("CellPortPort").filter(cpp => cpp.asInstanceOf[CellPortPort].getTargetIns() == ttip).asInstanceOf[List[CellPortPort]] - val rowCells = ModelElementLists.getElementsFromType("RowCellsCell").filter(cpp => rows.contains(cpp.asInstanceOf[RowCellsCell].getSourceIns())).asInstanceOf[List[RowCellsCell]] - var newCells: Set[Cell] = Set.empty - cellPorts.foreach(cpp => { - rowCells.foreach(rcc => { - if (rcc.getTargetIns() == cpp.getSourceIns()) { - newCells += rcc.getTargetIns() - } - }) - }) - println("Looking Port: " + ttip.getName() + " S: " + newCells.size) - if (newCells.size >= max) { - var setTrue: Set[Set[String]] = Set.empty - var setFalse: Set[Set[String]] = Set.empty - newCells.foreach(cell => { - if (cell.getValue()) { - var setPortValue: Set[String] = Set.empty - var ownerRow: Row = null - val rowCellsN = ModelElementLists.getElementsFromType("RowCellsCell").asInstanceOf[List[RowCellsCell]] - rowCellsN.filter(_.getTargetIns() == cell).foreach(rcc => ownerRow = rcc.getSourceIns()) - rowCellsN.filter(_.getSourceIns() == ownerRow).foreach(rcc => { - var cell = rcc.getTargetIns() - val cellPortsN = ModelElementLists.getElementsFromType("CellPortPort").asInstanceOf[List[CellPortPort]] - cellPortsN.filter(cpp => cpp.getSourceIns() == cell && cpp.getTargetIns().isInstanceOf[sum.tt.OutputPort]).foreach(cpp => { - setPortValue += s"${cpp.getTargetIns().getName()} ${cpp.getSourceIns().getValue()}" - }) - }) - setTrue += setPortValue - } else { - var setPortValue: Set[String] = Set.empty - var ownerRow: Row = null - val rowCellsN = ModelElementLists.getElementsFromType("RowCellsCell").asInstanceOf[List[RowCellsCell]] - rowCellsN.filter(_.getTargetIns() == cell).foreach(rcc => ownerRow = rcc.getSourceIns()) - rowCellsN.filter(_.getSourceIns() == ownerRow).foreach(rcc => { - var cell = rcc.getTargetIns() - val cellPortsN = ModelElementLists.getElementsFromType("CellPortPort").asInstanceOf[List[CellPortPort]] - cellPortsN.filter(cpp => cpp.getSourceIns() == cell && cpp.getTargetIns().isInstanceOf[sum.tt.OutputPort]).foreach(cpp => { - setPortValue += s"${cpp.getTargetIns().getName()} ${cpp.getSourceIns().getValue()}" - }) - }) - setFalse += setPortValue - } - }) - - val p1 = setTrue.size - val p2 = setFalse.size - if (p1 + p2 < numberFalse + numberTrue && p1 > 0 && p2 > 0 || numberTrue < 0) { - numberTrue = p1 - numberFalse = p2 - cellis = newCells - portTT = ttip - max = newCells.size - portBDD = bddip.asInstanceOf[sum.bdd.InputPort] - } - println("############################## " + newCells.size + " || T: " + p1 + " F: " + p2) - } - } - } - }) - println("Used Port: " + portTT) - var newPorts = finishPorts + portTT - val subtree = new Subtree() - val spi = new SubtreePortInputPort(subtree, portBDD) - spi.initialize() - createdObjects += subtree - createdObjects += spi - - val rowsOne = cellis.filter(_.getValue()).map(c => { - var row: Row = null - ModelElementLists.getElementsFromType("RowCellsCell").foreach(rcc => { - if (c == rcc.asInstanceOf[RowCellsCell].getTargetIns()) { - row = rcc.asInstanceOf[RowCellsCell].getSourceIns() - } - }) - row - }) - val rowsZero = cellis.filter(!_.getValue()).map(c => { - var row: Row = null - ModelElementLists.getElementsFromType("RowCellsCell").foreach(rcc => { - if (c == rcc.asInstanceOf[RowCellsCell].getTargetIns()) { - row = rcc.asInstanceOf[RowCellsCell].getSourceIns() - } - }) - row - }) - println("Rows (1) " + rowsOne.size + " (2) " + rowsZero.size) - - var treeZero: Tree = null - var treeOne: Tree = null - if (numberFalse == 1) { - treeZero = createLeafFromRows(rowsZero) - } else { - treeZero = createOutputSubtree(rowsZero, newPorts) - } - if (numberTrue == 1) { - treeOne = createLeafFromRows(rowsOne) - } else { - treeOne = createOutputSubtree(rowsOne, newPorts) - } - - val stf1 = new SubtreeTreeForOneTree(subtree, treeOne) - stf1.initialize() - createdObjects += stf1 - //connect to rows - connectTargetElementWithSourceElementes(treeOne, rowsOne.asInstanceOf[Set[PlayerSync]]) - - val stf0 = new SubtreeTreeForZeroTree(subtree, treeZero) - stf0.initialize() - createdObjects += stf0 - //connect to rows - connectTargetElementWithSourceElementes(treeZero, rowsZero.asInstanceOf[Set[PlayerSync]]) - - subtree - } - - def createInputSubtree(rows: Set[Row], finishPorts: Set[sum.tt.InputPort]): Tree = { - var max = 0 - var portTT: sum.tt.InputPort = null - var portBDD: sum.bdd.InputPort = null - var cellis: Set[Cell] = Set.empty - - createdObjects.filter(_.isInstanceOf[sum.bdd.InputPort]).foreach(bddip => { - val oppo: PlayerSync = +bddip getRelatedClassFromName ("InputPort") - if (oppo != null) { - val ttip = oppo.asInstanceOf[sum.tt.InputPort] - if (!finishPorts.contains(ttip)) { - val cellPorts = ModelElementLists.getElementsFromType("CellPortPort").filter(cpp => cpp.asInstanceOf[CellPortPort].getTargetIns() == ttip).asInstanceOf[List[CellPortPort]] - val rowCells = ModelElementLists.getElementsFromType("RowCellsCell").filter(cpp => rows.contains(cpp.asInstanceOf[RowCellsCell].getSourceIns())).asInstanceOf[List[RowCellsCell]] - var newCells: Set[Cell] = Set.empty - cellPorts.foreach(cpp => { - rowCells.foreach(rcc => { - if (rcc.getTargetIns() == cpp.getSourceIns()) { - newCells += rcc.getTargetIns() - } - }) - }) - if (newCells.size > max) { - max = newCells.size - cellis = newCells - portTT = ttip - portBDD = bddip.asInstanceOf[sum.bdd.InputPort] - } else if (newCells.size == max) { - val p1 = newCells.count(_.getValue()) - val p2 = newCells.count(!_.getValue()) - if (Math.abs(max / 2 - p1) > Math.abs(max / 2 - p2)) { - cellis = newCells - portTT = ttip - portBDD = bddip.asInstanceOf[sum.bdd.InputPort] - } - } - } - } - }) - println("Used Port: " + portTT) - var newPorts = finishPorts + portTT - val subtree = new Subtree() - val spi = new SubtreePortInputPort(subtree, portBDD) - spi.initialize() - createdObjects += subtree - createdObjects += spi - - val rowsOne = cellis.filter(_.getValue()).map(c => { - var row: Row = null - ModelElementLists.getElementsFromType("RowCellsCell").foreach(rcc => { - if (c == rcc.asInstanceOf[RowCellsCell].getTargetIns()) { - row = rcc.asInstanceOf[RowCellsCell].getSourceIns() - } - }) - row - }) - val rowsZero = cellis.filter(!_.getValue()).map(c => { - var row: Row = null - ModelElementLists.getElementsFromType("RowCellsCell").foreach(rcc => { - if (c == rcc.asInstanceOf[RowCellsCell].getTargetIns()) { - row = rcc.asInstanceOf[RowCellsCell].getSourceIns() - } - }) - row - }) - println("Rows (1) " + rowsOne.size + " (2) " + rowsZero.size) - - var treeZero: Tree = null - var treeOne: Tree = null - if (rowsZero.size == 1) { - treeZero = createLeafFromRows(rowsZero) - } else { - treeZero = createInputSubtree(rowsZero, newPorts) - } - if (rowsOne.size == 1) { - treeOne = createLeafFromRows(rowsOne) - } else { - treeOne = createInputSubtree(rowsOne, newPorts) - } - //TODO: Assignment what to do for more than one output cell - - val stf1 = new SubtreeTreeForOneTree(subtree, treeOne) - stf1.initialize() - createdObjects += stf1 - //connect to rows - connectTargetElementWithSourceElementes(treeOne, rowsOne.asInstanceOf[Set[PlayerSync]]) - - val stf0 = new SubtreeTreeForZeroTree(subtree, treeZero) - stf0.initialize() - createdObjects += stf0 - //connect to rows - connectTargetElementWithSourceElementes(treeZero, rowsZero.asInstanceOf[Set[PlayerSync]]) - - subtree - } - - def createLeafFromRows(rows: Set[Row]): Leaf = { - var leaf: Leaf = new Leaf() - createdObjects += leaf - //cells of output port - val cppsOutputPort = ModelElementLists.getElementsFromType("CellPortPort").filter(cpp => cpp.asInstanceOf[CellPortPort].getTargetIns().isInstanceOf[sum.tt.OutputPort]).asInstanceOf[List[CellPortPort]] - //TODO: Function element.getList(Type: CellPortPort) Relational compartments need function for names of references - //TODO: get list of elements from ref name - //cells of first row - val rccsFirstRow = ModelElementLists.getElementsFromType("RowCellsCell").filter(cpp => rows.head == cpp.asInstanceOf[RowCellsCell].getSourceIns()).asInstanceOf[List[RowCellsCell]] - //cells from first row - val cellsFirstRow = rccsFirstRow.map(_.getTargetIns()) - val allOutputCells = cppsOutputPort.map(_.getSourceIns()) - - cellsFirstRow.filter(allOutputCells.contains(_)).foreach(c => { - //Create new assignment and search all cells for it - val assignment = new Assignment(c.getValue()) - val laa = new LeafAssignmentsAssignment(leaf, assignment) - laa.initialize() - createdObjects += assignment - createdObjects += laa - - //get port from cell - val oport = cppsOutputPort.filter(_.getSourceIns() == c).map(_.getTargetIns()).head - var cellList: Set[Cell] = Set.empty - - rows.foreach(r => { - val cellsThisRow = ModelElementLists.getElementsFromType("RowCellsCell").filter(cpp => r == cpp.asInstanceOf[RowCellsCell].getSourceIns()).map(_.asInstanceOf[RowCellsCell].getTargetIns()) - cellList += cppsOutputPort.filter(cpp => cpp.getTargetIns() == oport && cellsThisRow.contains(cpp.getSourceIns())).map(_.getSourceIns()).head - }) - - val ttport: PlayerSync = +oport getRelatedClassFromName ("OutputPort") - if (ttport != null) { - val o_port = ttport.asInstanceOf[sum.bdd.OutputPort] - val apo = new AssignmentPortOutputPort(assignment, o_port) - apo.initialize() - createdObjects += apo - } - - //connect them - connectTargetElementWithSourceElementes(assignment, cellList.asInstanceOf[Set[PlayerSync]]) - - }) - leaf - } - - //---------------------------------------------------------------------------- Roles -------------------------------------------------------------------------------- - - class OutputPortConstruct() extends IIntegrator { - - def integrate(comp: PlayerSync): PlayerSync = { - println("OutputPort Integration " + comp); - - //Step 1: Get construction values - val name: String = +this getName () - - //Step 2: Create the object in the other models - val o_port = new sum.bdd.OutputPort(name) - - //Step 3: Make Connection - connectTargetElementWithSourceElemente(o_port, comp) - - createdObjects += o_port - - o_port - } - } - - class InputPortConstruct() extends IIntegrator { - - def integrate(comp: PlayerSync): PlayerSync = { - println("InputPort Integration " + comp); - - //Step 1: Get construction values - val name: String = +this getName () - - //Step 2: Create the object in the other models - val i_port = new sum.bdd.InputPort(name) - - //Step 3: Make Connection - connectTargetElementWithSourceElemente(i_port, comp) - - createdObjects += i_port - - i_port - } - } - - class TruthTableConstruct() extends IIntegrator { - - def integrate(comp: PlayerSync): PlayerSync = { - println("TruthTable Integration " + comp); - - //Step 1: Get construction values - val name: String = +this getName () - - //Step 2: Create the object in the other models - val bdd = new BDD(name) - - //Step 3: Make Connection - connectTargetElementWithSourceElemente(bdd, comp) - - createdObjects += bdd - - bdd - } - } - - //---------------------------------------------------------------------------- Relational Roles -------------------------------------------------------------------------------- - - class TruthTablePortsPortConstruct() extends IIntegrator { - - def integrate(comp: PlayerSync): PlayerSync = { - println("TruthTablePortsPort Integration " + comp); - - //Step 1: Get construction values - val source: IRelationRole = +this getSource () - val target: IRelationRole = +this getTarget () - - val oppSource: PlayerSync = +source getRelatedClassFromName ("BDD") - val oppTarget: PlayerSync = +target getRelatedClassFromName ("Port") - - if (oppSource != null && oppTarget != null) { - val s = oppSource.asInstanceOf[BDD] - val t = oppTarget.asInstanceOf[sum.bdd.Port] - - //Step 2: Create the object in the other models - val rel = new BDDPortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - connectTargetElementWithSourceElemente(rel, comp) - - createdObjects += rel - - return rel - } - null - } - } - -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/worksum/CreateTruthTableSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/CreateTruthTableSum.scala deleted file mode 100644 index 3b3b4afd1da1e258cefe098f70d212db500e305e..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/CreateTruthTableSum.scala +++ /dev/null @@ -1,46 +0,0 @@ -package ttc2019.worksum - -import sum.tt._ -import org.eclipse.emf.ecore.EObject -import ttc2019.ICreateTruthTable - -class CreateTruthTableSum extends ICreateTruthTable { - - var mapping: Map[EObject, Object] = Map.empty - - def createTruthTable(name: String, id: EObject): Unit = { - mapping = mapping + (id -> new TruthTable(name, null)) - } - - def createInputPort(name: String, id: EObject): Unit = { - mapping = mapping + (id -> new InputPort(name, null)) - } - - def createOutputPort(name: String, id: EObject): Unit = { - mapping = mapping + (id -> new OutputPort(name, null)) - } - - def createRow(id: EObject): Unit = { - mapping = mapping + (id -> new Row(null)) - } - - def createCell(value: Boolean, id: EObject): Unit = { - mapping = mapping + (id -> new Cell(value, null)) - } - - 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: EObject, port: EObject): Unit = { - (new TruthTablePortsPort(mapping.get(tt).get.asInstanceOf[TruthTable], mapping.get(port).get.asInstanceOf[Port])).initialize() - } - - 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: 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/worksum/SyncHeadNamesSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncHeadNamesSum.scala deleted file mode 100644 index 3a05f4b5f38f6de8c36f8b45ae3e9694db5fdccf..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/SyncHeadNamesSum.scala +++ /dev/null @@ -1,57 +0,0 @@ -package ttc2019.worksum - -import org.rosi_project.model_management.sync.ISyncCompartment -import org.rosi_project.model_management.sync.roles.ISyncRole - -/** - * Synchronization compartment for full name split with space. - */ -class SyncHeadNamesSum() extends ISyncCompartment { - - def getNextRole(classname: Object): ISyncRole = { - if (classname.isInstanceOf[sum.bdd.BDD] || classname.isInstanceOf[sum.bddg.BDD] || classname.isInstanceOf[sum.tt.TruthTable]) - return new Sync() - return null - } - - def getFirstRole(classname: Object): ISyncRole = { - if (classname.isInstanceOf[sum.bdd.BDD] || classname.isInstanceOf[sum.bddg.BDD] || classname.isInstanceOf[sum.tt.TruthTable]) - return new Sync() - return null - } - - def isNextIntegration(classname: Object): Boolean = { - if (classname.isInstanceOf[sum.bdd.BDD] || classname.isInstanceOf[sum.bddg.BDD] || classname.isInstanceOf[sum.tt.TruthTable]) - return true - return false - } - - def isFirstIntegration(classname: Object): Boolean = { - if (classname.isInstanceOf[sum.bdd.BDD] || classname.isInstanceOf[sum.bddg.BDD] || classname.isInstanceOf[sum.tt.TruthTable]) - return true - return false - } - - def getNewInstance(): ISyncCompartment = new SyncHeadNamesSum - - def getRuleName(): String = "SyncHeadNamesSum" - - class Sync() extends ISyncRole { - - def getOuterCompartment(): ISyncCompartment = SyncHeadNamesSum.this - - def changeName(): Unit = { - if (!doSync) { - doSync = true; - var name: String = +this getName(); - syncer.foreach { a => - if (!a.equals(this)) { - (+a).setName(name); - } - } - doSync = false; - } - } - } - -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/worksum/SyncInputPortNamesSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncInputPortNamesSum.scala deleted file mode 100644 index 42dedb33506159007bcc52c80c9ceac791c0bd51..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/SyncInputPortNamesSum.scala +++ /dev/null @@ -1,57 +0,0 @@ -package ttc2019.worksum - -import org.rosi_project.model_management.sync.ISyncCompartment -import org.rosi_project.model_management.sync.roles.ISyncRole - -/** - * Synchronization compartment for full name split with space. - */ -class SyncInputPortNamesSum() extends ISyncCompartment { - - def getNextRole(classname: Object): ISyncRole = { - if (classname.isInstanceOf[sum.bdd.InputPort] || classname.isInstanceOf[sum.bddg.InputPort] || classname.isInstanceOf[sum.tt.InputPort]) - return new Sync() - return null - } - - def getFirstRole(classname: Object): ISyncRole = { - if (classname.isInstanceOf[sum.bdd.InputPort] || classname.isInstanceOf[sum.bddg.InputPort] || classname.isInstanceOf[sum.tt.InputPort]) - return new Sync() - return null - } - - def isNextIntegration(classname: Object): Boolean = { - if (classname.isInstanceOf[sum.bdd.InputPort] || classname.isInstanceOf[sum.bddg.InputPort] || classname.isInstanceOf[sum.tt.InputPort]) - return true - return false - } - - def isFirstIntegration(classname: Object): Boolean = { - if (classname.isInstanceOf[sum.bdd.InputPort] || classname.isInstanceOf[sum.bddg.InputPort] || classname.isInstanceOf[sum.tt.InputPort]) - return true - return false - } - - def getNewInstance(): ISyncCompartment = new SyncInputPortNamesSum - - def getRuleName(): String = "SyncInputPortNamesSum" - - class Sync() extends ISyncRole { - - def getOuterCompartment(): ISyncCompartment = SyncInputPortNamesSum.this - - def changeName(): Unit = { - if (!doSync) { - doSync = true; - var name: String = +this getName(); - syncer.foreach { a => - if (!a.equals(this)) { - (+a).setName(name); - } - } - doSync = false; - } - } - } - -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/worksum/SyncOutputPortNamesSum.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/SyncOutputPortNamesSum.scala deleted file mode 100644 index 89bcf7e3efbdc56093bdca7a036ac85008261bae..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/SyncOutputPortNamesSum.scala +++ /dev/null @@ -1,57 +0,0 @@ -package ttc2019.worksum - -import org.rosi_project.model_management.sync.ISyncCompartment -import org.rosi_project.model_management.sync.roles.ISyncRole - -/** - * Synchronization compartment for full name split with space. - */ -class SyncOutputPortNamesSum() extends ISyncCompartment { - - def getNextRole(classname: Object): ISyncRole = { - if (classname.isInstanceOf[sum.bdd.OutputPort] || classname.isInstanceOf[sum.bddg.OutputPort] || classname.isInstanceOf[sum.tt.OutputPort]) - return new Sync() - return null - } - - def getFirstRole(classname: Object): ISyncRole = { - if (classname.isInstanceOf[sum.bdd.OutputPort] || classname.isInstanceOf[sum.bddg.OutputPort] || classname.isInstanceOf[sum.tt.OutputPort]) - return new Sync() - return null - } - - def isNextIntegration(classname: Object): Boolean = { - if (classname.isInstanceOf[sum.bdd.OutputPort] || classname.isInstanceOf[sum.bddg.OutputPort] || classname.isInstanceOf[sum.tt.OutputPort]) - return true - return false - } - - def isFirstIntegration(classname: Object): Boolean = { - if (classname.isInstanceOf[sum.bdd.OutputPort] || classname.isInstanceOf[sum.bddg.OutputPort] || classname.isInstanceOf[sum.tt.OutputPort]) - return true - return false - } - - def getNewInstance(): ISyncCompartment = new SyncOutputPortNamesSum - - def getRuleName(): String = "SyncOutputPortNamesSum" - - class Sync() extends ISyncRole { - - def getOuterCompartment(): ISyncCompartment = SyncOutputPortNamesSum.this - - def changeName(): Unit = { - if (!doSync) { - doSync = true; - var name: String = +this getName(); - syncer.foreach { a => - if (!a.equals(this)) { - (+a).setName(name); - } - } - doSync = false; - } - } - } - -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/worksum/TTandBDTandBDDSumConstruction.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/TTandBDTandBDDSumConstruction.scala deleted file mode 100644 index d2e7f62bb7e933050a23ded2e215fb35a85fa646..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/TTandBDTandBDDSumConstruction.scala +++ /dev/null @@ -1,376 +0,0 @@ -package ttc2019.worksum - -import org.rosi_project.model_management.sync.IConstructionCompartment -import org.rosi_project.model_management.sync.roles.IConstructor -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 -import org.rosi_project.model_management.sum.roles.IRelationRole - - - -/** - * Construction Process for Model BDD and TT. - */ -object TTandBDTandBDDSumConstruction extends IConstructionCompartment { - - def getConstructorForClassName(classname: Object): IConstructor = { - if (classname.isInstanceOf[sum.tt.TruthTable]) - return new TTTruthTableConstruct() - if (classname.isInstanceOf[sum.bddg.BDD]) - return new BDDBddConstruct() - if (classname.isInstanceOf[sum.bdd.BDD]) - return new BDTBddConstruct() - - if (classname.isInstanceOf[sum.tt.InputPort]) - return new TTInputPortConstruct() - if (classname.isInstanceOf[sum.bddg.InputPort]) - return new BDDInputPortConstruct() - if (classname.isInstanceOf[sum.bdd.InputPort]) - return new BDTInputPortConstruct() - - if (classname.isInstanceOf[sum.tt.OutputPort]) - return new TTOutputPortConstruct() - if (classname.isInstanceOf[sum.bddg.OutputPort]) - return new BDDOutputPortConstruct() - if (classname.isInstanceOf[sum.bdd.OutputPort]) - return new BDTOutputPortConstruct() - - if (classname.isInstanceOf[sum.tt.TruthTablePortsPort]) - return new TTPortsConnectionConstruct() - if (classname.isInstanceOf[sum.bddg.BDDPortsPort]) - return new BDDPortsConnectionConstruct() - if (classname.isInstanceOf[sum.bdd.BDDPortsPort]) - return new BDTPortsConnectionConstruct() - return null - } - - def getRuleName: String = "TTandBDTandBDDSyncConstruction" - - class TTTruthTableConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val dBdd = new sum.bddg.BDD(name) - val tBdd = new sum.bdd.BDD(name) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, dBdd, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tBdd, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDDBddConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val tt = new sum.tt.TruthTable(name, null) - val tBdd = new sum.bdd.BDD(name) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, tt, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tBdd, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDTBddConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val dBdd = new sum.bddg.BDD(name) - val tt = new sum.tt.TruthTable(name, null) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, dBdd, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tt, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class TTInputPortConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val dIn = new sum.bddg.InputPort(name) - val tIn = new sum.bdd.InputPort(name) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, dIn, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tIn, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDDInputPortConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val ttIn = new sum.tt.InputPort(name, null) - val tIn = new sum.bdd.InputPort(name) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, ttIn, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tIn, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDTInputPortConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val dIn = new sum.bddg.InputPort(name) - val ttIn = new sum.tt.InputPort(name, null) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, dIn, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, ttIn, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class TTOutputPortConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val dOut = new sum.bddg.OutputPort(name) - val tOut = new sum.bdd.OutputPort(name) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, dOut, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tOut, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDDOutputPortConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val ttOut = new sum.tt.OutputPort(name, null) - val tOut = new sum.bdd.OutputPort(name) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, ttOut, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, tOut, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDTOutputPortConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val name: String = +this getName() - - //Step 2: Create the object in the other models - val dOut = new sum.bddg.OutputPort(name) - val ttOut = new sum.tt.OutputPort(name, null) - - //Step 3: Create Containers - createContainerElement(true, true, comp, man) - createContainerElement(false, true, dOut, SynchronizationCompartment.createRoleManager()) - createContainerElement(false, true, ttOut, SynchronizationCompartment.createRoleManager()) - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class TTPortsConnectionConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val source: IRelationRole = +this getSource () - val target: IRelationRole = +this getTarget () - - createContainerElement(true, true, comp, man) - - val oppSoBDT: PlayerSync = +source getRelatedClassFromName ("bdd.BDD") - val oppTaBDT: PlayerSync = +target getRelatedClassFromName ("bdd.Port") - - //Step 2 and 3 - if (oppSoBDT != null && oppTaBDT != null) { - val s = oppSoBDT.asInstanceOf[sum.bdd.BDD] - val t = oppTaBDT.asInstanceOf[sum.bdd.Port] - - //Step 2: Create the object in the other models - val rel = new sum.bdd.BDDPortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - createContainerElement(false, true, rel, SynchronizationCompartment.createRoleManager()) - } - - val oppSoBDD: PlayerSync = +source getRelatedClassFromName ("bddg.BDD") - val oppTaBDD: PlayerSync = +target getRelatedClassFromName ("bddg.Port") - - //Step 2 and 3 - if (oppSoBDD != null && oppTaBDD != null) { - val s = oppSoBDD.asInstanceOf[sum.bddg.BDD] - val t = oppTaBDD.asInstanceOf[sum.bddg.Port] - - //Step 2: Create the object in the other models - val rel = new sum.bddg.BDDPortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - createContainerElement(false, true, rel, SynchronizationCompartment.createRoleManager()) - } - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDDPortsConnectionConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val source: IRelationRole = +this getSource () - val target: IRelationRole = +this getTarget () - - createContainerElement(true, true, comp, man) - - val oppSoBDT: PlayerSync = +source getRelatedClassFromName ("bdd.BDD") - val oppTaBDT: PlayerSync = +target getRelatedClassFromName ("bdd.Port") - - //Step 2 and 3 - if (oppSoBDT != null && oppTaBDT != null) { - val s = oppSoBDT.asInstanceOf[sum.bdd.BDD] - val t = oppTaBDT.asInstanceOf[sum.bdd.Port] - - //Step 2: Create the object in the other models - val rel = new sum.bdd.BDDPortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - createContainerElement(false, true, rel, SynchronizationCompartment.createRoleManager()) - } - - val oppSoTT: PlayerSync = +source getRelatedClassFromName ("tt.TruthTable") - val oppTaTT: PlayerSync = +target getRelatedClassFromName ("tt.Port") - - //Step 2 and 3 - if (oppSoTT != null && oppTaTT != null) { - val s = oppSoTT.asInstanceOf[sum.tt.TruthTable] - val t = oppTaTT.asInstanceOf[sum.tt.Port] - - //Step 2: Create the object in the other models - val rel = new sum.tt.TruthTablePortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - createContainerElement(false, true, rel, SynchronizationCompartment.createRoleManager()) - } - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class BDTPortsConnectionConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //Step 1: Get construction values - val source: IRelationRole = +this getSource () - val target: IRelationRole = +this getTarget () - - createContainerElement(true, true, comp, man) - - val oppSoTT: PlayerSync = +source getRelatedClassFromName ("tt.TruthTable") - val oppTaTT: PlayerSync = +target getRelatedClassFromName ("tt.Port") - - //Step 2 and 3 - if (oppSoTT != null && oppTaTT != null) { - val s = oppSoTT.asInstanceOf[sum.tt.TruthTable] - val t = oppTaTT.asInstanceOf[sum.tt.Port] - - //Step 2: Create the object in the other models - val rel = new sum.tt.TruthTablePortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - createContainerElement(false, true, rel, SynchronizationCompartment.createRoleManager()) - } - - val oppSoBDD: PlayerSync = +source getRelatedClassFromName ("bddg.BDD") - val oppTaBDD: PlayerSync = +target getRelatedClassFromName ("bddg.Port") - - //Step 2 and 3 - if (oppSoBDD != null && oppTaBDD != null) { - val s = oppSoBDD.asInstanceOf[sum.bddg.BDD] - val t = oppTaBDD.asInstanceOf[sum.bddg.Port] - - //Step 2: Create the object in the other models - val rel = new sum.bddg.BDDPortsPort(s, t) - rel.initialize() - - //Step 3: Make Connection - createContainerElement(false, true, rel, SynchronizationCompartment.createRoleManager()) - } - - //Step 4: Finish Creation - makeCompleteConstructionProcess(containers) - } - } - - class TTRowConstruct() extends IConstructor { - - def construct(comp: PlayerSync, man: IRoleManager): Unit = { - //TODO: modify the whole tree - //TODO: Cell construct does not make sense directly - } - } - -} \ No newline at end of file diff --git a/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBddOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBddOutput.scala deleted file mode 100644 index 4a10be09304c6396bb01a9becb090cc96d089907..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBddOutput.scala +++ /dev/null @@ -1,111 +0,0 @@ -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 { - - def generateEverything(outputFile: String): Unit = { - val creation = new BddCreationHelper() - - val pkgName = "sum.bddg." - - 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[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) - println(ou) - println(as) - println(le) - println(su) - - println(apo) - println(bpp) - println(btt) - println(brt) - 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()) - }) - brt.foreach(o => { - creation.addBDDRootConnection(o.getTargetIns()) - }) - btt.foreach(o => { - creation.addBDDTreesConnection(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/worksum/WriteSumBdtOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBdtOutput.scala deleted file mode 100644 index ca4172a762f0d11ce12de534809dafd75be9bb54..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumBdtOutput.scala +++ /dev/null @@ -1,106 +0,0 @@ -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 { - - def generateEverything(outputFile: String): Unit = { - val creation = new BdtCreationHelper() - - val pkgName = "sum.bdd." - - 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[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) - 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/worksum/WriteSumTtOutput.scala b/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumTtOutput.scala deleted file mode 100644 index 9d3bd89a8fafb869fb17f97a376ab107c2d69774..0000000000000000000000000000000000000000 --- a/solutions/RSync/src/main/scala/ttc2019/worksum/WriteSumTtOutput.scala +++ /dev/null @@ -1,70 +0,0 @@ -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 = { - val creation = new TtCreationHelper() - - val pkgName = "sum.tt." - - 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[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) - println(ou) - println(ro) - println(ce) - - println(cpp) - println(rcc) - println(tpp) - println(trr)*/ - - //add normal instances - tt.foreach(o => { - creation.createTT(o, o.getName()) - }) - in.foreach(o => { - creation.createInputPort(o, o.getName()) - }) - ou.foreach(o => { - creation.createOutputPort(o, o.getName()) - }) - ro.foreach(o => { - creation.createRow(o) - }) - ce.foreach(o => { - creation.createCell(o, o.getValue()) - }) - - //add connections - cpp.foreach(o => { - creation.addPortCellsConnection(o.getTargetIns(), o.getSourceIns()) - }) - rcc.foreach(o => { - creation.addRowCellsConnection(o.getSourceIns(), o.getTargetIns()) - }) - tpp.foreach(o => { - creation.addTTPortConnection(o.getTargetIns()) - }) - trr.foreach(o => { - creation.addTTRowConnection(o.getTargetIns()) - }) - - //generate output file - creation.generate(outputFile) - } -} \ No newline at end of file