Skip to main content
Sign in
Snippets Groups Projects
Commit e467c3a2 authored by Chrissi's avatar Chrissi
Browse files

newest version of rsync

parent dbaaa5e5
No related branches found
No related tags found
No related merge requests found
Showing
with 273 additions and 973 deletions
package tt
class TruthTable(protected var name: String, l_Location: String) extends LocatedElement(l_Location) {
def getName(): String = {
name
}
def setName(n: String): Unit = {
name = n
+this changeName ()
}
override def toString(): String = {
"TruthTable:" + " name=" + name + " location=" + location
}
}
\ No newline at end of file
package tt
import org.rosi_project.model_management.sum.compartments.IComposition
class TruthTablePortsPort(private val sInstance: TruthTable, private val tInstance: Port) extends IComposition {
override def internalInitialize(): Unit = {
this.source = new Source()
this.target = new Target()
sInstance play this.source
tInstance play this.target
}
override def toString(): String = {
"[TruthTablePortsPort " + source + ", " + target + "]"
}
def getSourceIns(): TruthTable = {
return sInstance
}
def getTargetIns(): Port = {
return tInstance
}
class Source extends ICompositionSource {
override def toString(): String = {
"S: (" + sInstance + ")"
}
}
class Target extends ICompositionTarget {
override def toString(): String = {
"T: (" + tInstance + ")"
}
}
}
\ No newline at end of file
package tt
import org.rosi_project.model_management.sum.compartments.IComposition
class TruthTableRowsRow(private val sInstance: TruthTable, private val tInstance: Row) extends IComposition {
override def internalInitialize(): Unit = {
this.source = new Source()
this.target = new Target()
sInstance play this.source
tInstance play this.target
}
override def toString(): String = {
"[TruthTableRowsRow " + source + ", " + target + "]"
}
def getSourceIns(): TruthTable = {
return sInstance
}
def getTargetIns(): Row = {
return tInstance
}
class Source extends ICompositionSource {
override def toString(): String = {
"S: (" + sInstance + ")"
}
}
class Target extends ICompositionTarget {
override def toString(): String = {
"T: (" + tInstance + ")"
}
}
}
\ No newline at end of file
......@@ -5,6 +5,9 @@ import org.rosi_project.model_management.core.SynchronizationCompartment
import org.rosi_project.model_management.core.RsumCompartment
import org.rosi_project.model_management.core.ModelElementLists
import org.rosi_project.model_management.sync.IIntegrationCompartment
import ttc2019.metamodels.tt.TruthTable
import ttc2019.worksync._
import ttc2019.worksum._
/** The `CompleteTTCProcess` executes the entire transformation workflow. Its methods are inspired
* by the different phases that the benchmark is expecting.
......@@ -18,7 +21,7 @@ object CompleteTTCProcess extends App {
var writeOut: IWriteOutputModel = _
var loader: TTCLoader = _
var validator: Validator = _
var saver: TTCEmfSaver = _
var saver: TruthTable = _
var processConfig: TTCProcessConfiguration = _
/** Performs necessary setup instructions such as loading the ecore meta-model.
......@@ -39,12 +42,12 @@ object CompleteTTCProcess extends App {
writeOut = WriteSumBdtOutput
}
this.processConfig = processConfig
saver = loader.loadEcore(processConfig.ttEcoreName, processConfig.ttFileName)
saver = loader.javaTTfromEcore(processConfig.ttEcoreName, processConfig.ttFileName)
}
/** Loads the truth table.
*/
def load(): Unit = loader.createTruthTableInstance(saver, ctts)
def load(): Unit = loader.createTruthTableRSYNCInstance(saver, ctts)
/** Transforms the truth table instance to a binary decision diagram.
*/
......
......
package ttc2019
import sync.tt._
import org.eclipse.emf.ecore.EObject
class CreateTruthTableDirectSync extends ICreateTruthTable {
//var mapping: Map[EObject, Object] = Map.empty
var truthttable: TruthTable = null
var rows: java.util.Map[EObject, Row] = new java.util.HashMap()
var cells: java.util.Map[EObject, Cell] = new java.util.HashMap()
var ports: java.util.Map[EObject, Port] = new java.util.HashMap()
def createTruthTable(name: String, id: EObject): Unit = {
truthttable = new TruthTable(name, Set.empty, Set.empty, null)
}
def createInputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new InputPort(name, Set.empty, null, null))
ports.put(id, new InputPort(name, Set.empty, null, null))
}
def createOutputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new OutputPort(name, Set.empty, null, null))
ports.put(id, new OutputPort(name, Set.empty, null, null))
}
def createRow(id: EObject): Unit = {
//mapping += (id -> new Row(Set.empty, null, null))
rows.put(id, new Row(Set.empty, null, null))
}
def createCell(value: Boolean, id: EObject): Unit = {
//mapping += (id -> new Cell(value, null, null, null))
cells.put(id, new Cell(value, null, null, null))
}
def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val r = mapping.get(row).get.asInstanceOf[Row]
val r = rows.get(row)
truthttable.addRows(r)
r.setOwner(truthttable)
}
def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val p = mapping.get(port).get.asInstanceOf[Port]
val p = ports.get(port)
truthttable.addPorts(p)
p.setOwner(truthttable)
}
def createRowCellsCell(row: EObject, cell: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val r = mapping.get(row).get.asInstanceOf[Row]
val c = cells.get(cell)
val r = rows.get(row)
c.setOwner(r)
r.addCells(c)
}
def createCellPortPort(cell: EObject, port: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val p = mapping.get(port).get.asInstanceOf[Port]
val c = cells.get(cell)
val p = ports.get(port)
c.setPort(p)
p.addCells(c)
}
}
\ No newline at end of file
package ttc2019
import sync.tt._
import org.eclipse.emf.ecore.EObject
//import scala.collection.mutable.Map
class CreateTruthTableSync extends ICreateTruthTable {
var mapping: Map[Int, Object] = Map.empty
//var mapping: Map[EObject, Object] = Map.empty
var mapping: java.util.Map[EObject, Object] = new java.util.HashMap()
def createTruthTable(name: String, id: Int): Unit = {
mapping = mapping + (id -> new TruthTable(name, Set.empty, Set.empty, null))
def createTruthTable(name: String, id: EObject): Unit = {
//mapping += (id -> new TruthTable(name, Set.empty, Set.empty, null))
mapping.put(id, new TruthTable(name, Set.empty, Set.empty, null))
}
def createInputPort(name: String, id: Int): Unit = {
mapping = mapping + (id -> new InputPort(name, Set.empty, null, null))
def createInputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new InputPort(name, Set.empty, null, null))
mapping.put(id, new InputPort(name, Set.empty, null, null))
}
def createOutputPort(name: String, id: Int): Unit = {
mapping = mapping + (id -> new OutputPort(name, Set.empty, null, null))
def createOutputPort(name: String, id: EObject): Unit = {
//mapping += (id -> new OutputPort(name, Set.empty, null, null))
mapping.put(id, new OutputPort(name, Set.empty, null, null))
}
def createRow(id: Int): Unit = {
mapping = mapping + (id -> new Row(Set.empty, null, null))
def createRow(id: EObject): Unit = {
//mapping += (id -> new Row(Set.empty, null, null))
mapping.put(id, new Row(Set.empty, null, null))
}
def createCell(value: Boolean, id: Int): Unit = {
mapping = mapping + (id -> new Cell(value, null, null, null))
def createCell(value: Boolean, id: EObject): Unit = {
//mapping += (id -> new Cell(value, null, null, null))
mapping.put(id, new Cell(value, null, null, null))
}
def createTruthTableRowsRow(tt: Int, row: Int): Unit = {
val t = mapping.get(tt).get.asInstanceOf[TruthTable]
val r = mapping.get(row).get.asInstanceOf[Row]
def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val r = mapping.get(row).get.asInstanceOf[Row]
val t = mapping.get(tt).asInstanceOf[TruthTable]
val r = mapping.get(row).asInstanceOf[Row]
t.addRows(r)
r.setOwner(t)
}
def createTruthTablePortsPort(tt: Int, port: Int): Unit = {
val t = mapping.get(tt).get.asInstanceOf[TruthTable]
val p = mapping.get(port).get.asInstanceOf[Port]
def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = {
//val t = mapping.get(tt).get.asInstanceOf[TruthTable]
//val p = mapping.get(port).get.asInstanceOf[Port]
val t = mapping.get(tt).asInstanceOf[TruthTable]
val p = mapping.get(port).asInstanceOf[Port]
t.addPorts(p)
p.setOwner(t)
}
def createRowCellsCell(row: Int, cell: Int): Unit = {
val c = mapping.get(cell).get.asInstanceOf[Cell]
val r = mapping.get(row).get.asInstanceOf[Row]
def createRowCellsCell(row: EObject, cell: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val r = mapping.get(row).get.asInstanceOf[Row]
val c = mapping.get(cell).asInstanceOf[Cell]
val r = mapping.get(row).asInstanceOf[Row]
c.setOwner(r)
r.addCells(c)
}
def createCellPortPort(cell: Int, port: Int): Unit = {
val c = mapping.get(cell).get.asInstanceOf[Cell]
val p = mapping.get(port).get.asInstanceOf[Port]
def createCellPortPort(cell: EObject, port: EObject): Unit = {
//val c = mapping.get(cell).get.asInstanceOf[Cell]
//val p = mapping.get(port).get.asInstanceOf[Port]
val c = mapping.get(cell).asInstanceOf[Cell]
val p = mapping.get(port).asInstanceOf[Port]
c.setPort(p)
p.addCells(c)
}
......
......
package ttc2019
import sum.tt._
import org.rosi_project.model_management.core._
import ttc2019.metamodels.create.Validator
import ttc2019.metamodels.create.Launcher
object ExampleCombiCase extends App {
SynchronizationCompartment combine RsumCompartment
val i0 = new TruthTable("Test", null)
val i1 = new InputPort("a", null)
val i2 = new InputPort("b", null)
val i3 = new InputPort("c", null)
val i4 = new InputPort("d", null)
val i5 = new OutputPort("s", null)
val i6 = new Row(null)
val i7 = new Cell(false, null)
val i8 = new Cell(false, null)
val i9 = new Cell(false, null)
val i10 = new Row(null)
val i11 = new Cell(false, null)
val i12 = new Cell(true, null)
val i13 = new Cell(false, null)
val i14 = new Cell(false, null)
val i15 = new Cell(true, null)
val i16 = new Row(null)
val i17 = new Cell(false, null)
val i18 = new Cell(true, null)
val i19 = new Cell(false, null)
val i20 = new Cell(true, null)
val i21 = new Cell(false, null)
val i22 = new Row(null)
val i23 = new Cell(false, null)
val i24 = new Cell(true, null)
val i25 = new Cell(true, null)
val i26 = new Cell(false, null)
val i27 = new Row(null)
val i28 = new Cell(true, null)
val i29 = new Cell(false, null)
val i30 = new Cell(false, null)
val i31 = new Cell(false, null)
val i32 = new Cell(false, null)
val i33 = new Row(null)
val i34 = new Cell(true, null)
val i35 = new Cell(false, null)
val i36 = new Cell(true, null)
val i37 = new Cell(false, null)
val i38 = new Cell(true, null)
val i39 = new Row(null)
val i40 = new Cell(true, null)
val i41 = new Cell(true, null)
val i42 = new Cell(false, null)
val i43 = new Row(null)
val i44 = new Cell(true, null)
val i45 = new Cell(true, null)
val i46 = new Cell(false, null)
val i47 = new Cell(false, null)
val i48 = new Cell(true, null)
val i49 = new Row(null)
val i50 = new Cell(true, null)
val i51 = new Cell(true, null)
val i52 = new Cell(true, null)
val i53 = new Cell(false, null)
val i54 = new Cell(false, null)
(new TruthTableRowsRow(i0, i6)).initialize()
(new TruthTableRowsRow(i0, i10)).initialize()
(new TruthTableRowsRow(i0, i16)).initialize()
(new TruthTableRowsRow(i0, i22)).initialize()
(new TruthTableRowsRow(i0, i27)).initialize()
(new TruthTableRowsRow(i0, i33)).initialize()
(new TruthTableRowsRow(i0, i39)).initialize()
(new TruthTableRowsRow(i0, i43)).initialize()
(new TruthTableRowsRow(i0, i49)).initialize()
(new TruthTablePortsPort(i0, i1)).initialize()
(new TruthTablePortsPort(i0, i2)).initialize()
(new TruthTablePortsPort(i0, i3)).initialize()
(new TruthTablePortsPort(i0, i4)).initialize()
(new TruthTablePortsPort(i0, i5)).initialize()
(new RowCellsCell(i6, i7)).initialize()
(new RowCellsCell(i6, i8)).initialize()
(new RowCellsCell(i6, i9)).initialize()
(new CellPortPort(i7, i1)).initialize()
(new CellPortPort(i8, i2)).initialize()
(new CellPortPort(i9, i5)).initialize()
(new RowCellsCell(i10, i11)).initialize()
(new RowCellsCell(i10, i12)).initialize()
(new RowCellsCell(i10, i13)).initialize()
(new RowCellsCell(i10, i14)).initialize()
(new RowCellsCell(i10, i15)).initialize()
(new CellPortPort(i11, i1)).initialize()
(new CellPortPort(i12, i2)).initialize()
(new CellPortPort(i13, i3)).initialize()
(new CellPortPort(i14, i4)).initialize()
(new CellPortPort(i15, i5)).initialize()
(new RowCellsCell(i16, i17)).initialize()
(new RowCellsCell(i16, i18)).initialize()
(new RowCellsCell(i16, i19)).initialize()
(new RowCellsCell(i16, i20)).initialize()
(new RowCellsCell(i16, i21)).initialize()
(new CellPortPort(i17, i1)).initialize()
(new CellPortPort(i18, i2)).initialize()
(new CellPortPort(i19, i3)).initialize()
(new CellPortPort(i20, i4)).initialize()
(new CellPortPort(i21, i5)).initialize()
(new RowCellsCell(i22, i23)).initialize()
(new RowCellsCell(i22, i24)).initialize()
(new RowCellsCell(i22, i25)).initialize()
(new RowCellsCell(i22, i26)).initialize()
(new CellPortPort(i23, i1)).initialize()
(new CellPortPort(i24, i2)).initialize()
(new CellPortPort(i25, i3)).initialize()
(new CellPortPort(i26, i5)).initialize()
(new RowCellsCell(i27, i28)).initialize()
(new RowCellsCell(i27, i29)).initialize()
(new RowCellsCell(i27, i30)).initialize()
(new RowCellsCell(i27, i31)).initialize()
(new RowCellsCell(i27, i32)).initialize()
(new CellPortPort(i28, i1)).initialize()
(new CellPortPort(i29, i2)).initialize()
(new CellPortPort(i30, i3)).initialize()
(new CellPortPort(i31, i4)).initialize()
(new CellPortPort(i32, i5)).initialize()
(new RowCellsCell(i33, i34)).initialize()
(new RowCellsCell(i33, i35)).initialize()
(new RowCellsCell(i33, i36)).initialize()
(new RowCellsCell(i33, i37)).initialize()
(new RowCellsCell(i33, i38)).initialize()
(new CellPortPort(i34, i1)).initialize()
(new CellPortPort(i35, i2)).initialize()
(new CellPortPort(i36, i3)).initialize()
(new CellPortPort(i37, i4)).initialize()
(new CellPortPort(i38, i5)).initialize()
(new RowCellsCell(i39, i40)).initialize()
(new RowCellsCell(i39, i41)).initialize()
(new RowCellsCell(i39, i42)).initialize()
(new CellPortPort(i40, i1)).initialize()
(new CellPortPort(i41, i4)).initialize()
(new CellPortPort(i42, i5)).initialize()
(new RowCellsCell(i43, i44)).initialize()
(new RowCellsCell(i43, i45)).initialize()
(new RowCellsCell(i43, i46)).initialize()
(new RowCellsCell(i43, i47)).initialize()
(new RowCellsCell(i43, i48)).initialize()
(new CellPortPort(i44, i1)).initialize()
(new CellPortPort(i45, i2)).initialize()
(new CellPortPort(i46, i3)).initialize()
(new CellPortPort(i47, i4)).initialize()
(new CellPortPort(i48, i5)).initialize()
(new RowCellsCell(i49, i50)).initialize()
(new RowCellsCell(i49, i51)).initialize()
(new RowCellsCell(i49, i52)).initialize()
(new RowCellsCell(i49, i53)).initialize()
(new RowCellsCell(i49, i54)).initialize()
(new CellPortPort(i50, i1)).initialize()
(new CellPortPort(i51, i2)).initialize()
(new CellPortPort(i52, i3)).initialize()
(new CellPortPort(i53, i4)).initialize()
(new CellPortPort(i54, i5)).initialize()
//ModelElementLists.printAll()
SynchronizationCompartment.integrateNewModel(BdtSumIntegration)
println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
ModelElementLists.printFromPackage("BDD")
//ModelElementLists.printAll()
val bddFileName = "Generated.bddmodel"
val ttFileName = "TTTest.ttmodel"
WriteSumBdtOutput.generateEverything(bddFileName)
val validator = new Launcher()
validator.launch(ttFileName, bddFileName)
}
\ No newline at end of file
package ttc2019
import sum.tt._
import org.rosi_project.model_management.core._
import ttc2019.metamodels.create.Validator
import ttc2019.metamodels.create.Launcher
object ExampleCombiCaseOO extends App {
SynchronizationCompartment combine RsumCompartment
val loader = new TTCLoader()
val validator = new Launcher()
val bddFileName = "Generated.bddmodel"
val ttFileName = "TT.ttmodel"
val ttEcoreName = "TT.ecore"
val saver = loader.loadEcore(ttEcoreName, ttFileName)
val i0 = new TruthTable("TableI4O2Seed42", null)
val i1 = new InputPort("I0", null)
val i2 = new InputPort("I1", null)
val i3 = new InputPort("I2", null)
val i4 = new InputPort("I3", null)
val i5 = new OutputPort("O0", null)
val i6 = new OutputPort("O1", null)
val i7 = new Row(null)
val i8 = new Cell(false, null)
val i9 = new Cell(false, null)
val i10 = new Cell(false, null)
val i11 = new Cell(false, null)
val i12 = new Cell(true, null)
val i13 = new Cell(false, null)
val i14 = new Row(null)
val i15 = new Cell(true, null)
val i16 = new Cell(false, null)
val i17 = new Cell(false, null)
val i18 = new Cell(false, null)
val i19 = new Cell(true, null)
val i20 = new Cell(false, null)
val i21 = new Row(null)
val i22 = new Cell(false, null)
val i23 = new Cell(true, null)
val i24 = new Cell(false, null)
val i25 = new Cell(false, null)
val i26 = new Cell(false, null)
val i27 = new Cell(true, null)
val i28 = new Row(null)
val i29 = new Cell(true, null)
val i30 = new Cell(true, null)
val i31 = new Cell(false, null)
val i32 = new Cell(false, null)
val i33 = new Cell(false, null)
val i34 = new Cell(true, null)
val i35 = new Row(null)
val i36 = new Cell(false, null)
val i37 = new Cell(false, null)
val i38 = new Cell(true, null)
val i39 = new Cell(false, null)
val i40 = new Cell(true, null)
val i41 = new Cell(false, null)
val i42 = new Row(null)
val i43 = new Cell(true, null)
val i44 = new Cell(false, null)
val i45 = new Cell(true, null)
val i46 = new Cell(false, null)
val i47 = new Cell(true, null)
val i48 = new Cell(false, null)
val i49 = new Row(null)
val i50 = new Cell(false, null)
val i51 = new Cell(true, null)
val i52 = new Cell(true, null)
val i53 = new Cell(false, null)
val i54 = new Cell(false, null)
val i55 = new Cell(false, null)
val i56 = new Row(null)
val i57 = new Cell(true, null)
val i58 = new Cell(true, null)
val i59 = new Cell(true, null)
val i60 = new Cell(false, null)
val i61 = new Cell(false, null)
val i62 = new Cell(true, null)
val i63 = new Row(null)
val i64 = new Cell(false, null)
val i65 = new Cell(false, null)
val i66 = new Cell(false, null)
val i67 = new Cell(true, null)
val i68 = new Cell(false, null)
val i69 = new Cell(true, null)
val i70 = new Row(null)
val i71 = new Cell(true, null)
val i72 = new Cell(false, null)
val i73 = new Cell(false, null)
val i74 = new Cell(true, null)
val i75 = new Cell(true, null)
val i76 = new Cell(true, null)
val i77 = new Row(null)
val i78 = new Cell(false, null)
val i79 = new Cell(true, null)
val i80 = new Cell(false, null)
val i81 = new Cell(true, null)
val i82 = new Cell(true, null)
val i83 = new Cell(false, null)
val i84 = new Row(null)
val i85 = new Cell(true, null)
val i86 = new Cell(true, null)
val i87 = new Cell(false, null)
val i88 = new Cell(true, null)
val i89 = new Cell(false, null)
val i90 = new Cell(false, null)
val i91 = new Row(null)
val i92 = new Cell(false, null)
val i93 = new Cell(false, null)
val i94 = new Cell(true, null)
val i95 = new Cell(true, null)
val i96 = new Cell(true, null)
val i97 = new Cell(true, null)
val i98 = new Row(null)
val i99 = new Cell(true, null)
val i100 = new Cell(false, null)
val i101 = new Cell(true, null)
val i102 = new Cell(true, null)
val i103 = new Cell(false, null)
val i104 = new Cell(true, null)
val i105 = new Row(null)
val i106 = new Cell(false, null)
val i107 = new Cell(true, null)
val i108 = new Cell(true, null)
val i109 = new Cell(true, null)
val i110 = new Cell(false, null)
val i111 = new Cell(false, null)
val i112 = new Row(null)
val i113 = new Cell(true, null)
val i114 = new Cell(true, null)
val i115 = new Cell(true, null)
val i116 = new Cell(true, null)
val i117 = new Cell(true, null)
val i118 = new Cell(false, null)
(new TruthTableRowsRow(i0, i7)).initialize()
(new TruthTableRowsRow(i0, i14)).initialize()
(new TruthTableRowsRow(i0, i21)).initialize()
(new TruthTableRowsRow(i0, i28)).initialize()
(new TruthTableRowsRow(i0, i35)).initialize()
(new TruthTableRowsRow(i0, i42)).initialize()
(new TruthTableRowsRow(i0, i49)).initialize()
(new TruthTableRowsRow(i0, i56)).initialize()
(new TruthTableRowsRow(i0, i63)).initialize()
(new TruthTableRowsRow(i0, i70)).initialize()
(new TruthTableRowsRow(i0, i77)).initialize()
(new TruthTableRowsRow(i0, i84)).initialize()
(new TruthTableRowsRow(i0, i91)).initialize()
(new TruthTableRowsRow(i0, i98)).initialize()
(new TruthTableRowsRow(i0, i105)).initialize()
(new TruthTableRowsRow(i0, i112)).initialize()
(new TruthTablePortsPort(i0, i1)).initialize()
(new TruthTablePortsPort(i0, i2)).initialize()
(new TruthTablePortsPort(i0, i3)).initialize()
(new TruthTablePortsPort(i0, i4)).initialize()
(new TruthTablePortsPort(i0, i5)).initialize()
(new TruthTablePortsPort(i0, i6)).initialize()
(new RowCellsCell(i7, i8)).initialize()
(new RowCellsCell(i7, i9)).initialize()
(new RowCellsCell(i7, i10)).initialize()
(new RowCellsCell(i7, i11)).initialize()
(new RowCellsCell(i7, i12)).initialize()
(new RowCellsCell(i7, i13)).initialize()
(new CellPortPort(i8, i1)).initialize()
(new CellPortPort(i9, i2)).initialize()
(new CellPortPort(i10, i3)).initialize()
(new CellPortPort(i11, i4)).initialize()
(new CellPortPort(i12, i5)).initialize()
(new CellPortPort(i13, i6)).initialize()
(new RowCellsCell(i14, i15)).initialize()
(new RowCellsCell(i14, i16)).initialize()
(new RowCellsCell(i14, i17)).initialize()
(new RowCellsCell(i14, i18)).initialize()
(new RowCellsCell(i14, i19)).initialize()
(new RowCellsCell(i14, i20)).initialize()
(new CellPortPort(i15, i1)).initialize()
(new CellPortPort(i16, i2)).initialize()
(new CellPortPort(i17, i3)).initialize()
(new CellPortPort(i18, i4)).initialize()
(new CellPortPort(i19, i5)).initialize()
(new CellPortPort(i20, i6)).initialize()
(new RowCellsCell(i21, i22)).initialize()
(new RowCellsCell(i21, i23)).initialize()
(new RowCellsCell(i21, i24)).initialize()
(new RowCellsCell(i21, i25)).initialize()
(new RowCellsCell(i21, i26)).initialize()
(new RowCellsCell(i21, i27)).initialize()
(new CellPortPort(i22, i1)).initialize()
(new CellPortPort(i23, i2)).initialize()
(new CellPortPort(i24, i3)).initialize()
(new CellPortPort(i25, i4)).initialize()
(new CellPortPort(i26, i5)).initialize()
(new CellPortPort(i27, i6)).initialize()
(new RowCellsCell(i28, i29)).initialize()
(new RowCellsCell(i28, i30)).initialize()
(new RowCellsCell(i28, i31)).initialize()
(new RowCellsCell(i28, i32)).initialize()
(new RowCellsCell(i28, i33)).initialize()
(new RowCellsCell(i28, i34)).initialize()
(new CellPortPort(i29, i1)).initialize()
(new CellPortPort(i30, i2)).initialize()
(new CellPortPort(i31, i3)).initialize()
(new CellPortPort(i32, i4)).initialize()
(new CellPortPort(i33, i5)).initialize()
(new CellPortPort(i34, i6)).initialize()
(new RowCellsCell(i35, i36)).initialize()
(new RowCellsCell(i35, i37)).initialize()
(new RowCellsCell(i35, i38)).initialize()
(new RowCellsCell(i35, i39)).initialize()
(new RowCellsCell(i35, i40)).initialize()
(new RowCellsCell(i35, i41)).initialize()
(new CellPortPort(i36, i1)).initialize()
(new CellPortPort(i37, i2)).initialize()
(new CellPortPort(i38, i3)).initialize()
(new CellPortPort(i39, i4)).initialize()
(new CellPortPort(i40, i5)).initialize()
(new CellPortPort(i41, i6)).initialize()
(new RowCellsCell(i42, i43)).initialize()
(new RowCellsCell(i42, i44)).initialize()
(new RowCellsCell(i42, i45)).initialize()
(new RowCellsCell(i42, i46)).initialize()
(new RowCellsCell(i42, i47)).initialize()
(new RowCellsCell(i42, i48)).initialize()
(new CellPortPort(i43, i1)).initialize()
(new CellPortPort(i44, i2)).initialize()
(new CellPortPort(i45, i3)).initialize()
(new CellPortPort(i46, i4)).initialize()
(new CellPortPort(i47, i5)).initialize()
(new CellPortPort(i48, i6)).initialize()
(new RowCellsCell(i49, i50)).initialize()
(new RowCellsCell(i49, i51)).initialize()
(new RowCellsCell(i49, i52)).initialize()
(new RowCellsCell(i49, i53)).initialize()
(new RowCellsCell(i49, i54)).initialize()
(new RowCellsCell(i49, i55)).initialize()
(new CellPortPort(i50, i1)).initialize()
(new CellPortPort(i51, i2)).initialize()
(new CellPortPort(i52, i3)).initialize()
(new CellPortPort(i53, i4)).initialize()
(new CellPortPort(i54, i5)).initialize()
(new CellPortPort(i55, i6)).initialize()
(new RowCellsCell(i56, i57)).initialize()
(new RowCellsCell(i56, i58)).initialize()
(new RowCellsCell(i56, i59)).initialize()
(new RowCellsCell(i56, i60)).initialize()
(new RowCellsCell(i56, i61)).initialize()
(new RowCellsCell(i56, i62)).initialize()
(new CellPortPort(i57, i1)).initialize()
(new CellPortPort(i58, i2)).initialize()
(new CellPortPort(i59, i3)).initialize()
(new CellPortPort(i60, i4)).initialize()
(new CellPortPort(i61, i5)).initialize()
(new CellPortPort(i62, i6)).initialize()
(new RowCellsCell(i63, i64)).initialize()
(new RowCellsCell(i63, i65)).initialize()
(new RowCellsCell(i63, i66)).initialize()
(new RowCellsCell(i63, i67)).initialize()
(new RowCellsCell(i63, i68)).initialize()
(new RowCellsCell(i63, i69)).initialize()
(new CellPortPort(i64, i1)).initialize()
(new CellPortPort(i65, i2)).initialize()
(new CellPortPort(i66, i3)).initialize()
(new CellPortPort(i67, i4)).initialize()
(new CellPortPort(i68, i5)).initialize()
(new CellPortPort(i69, i6)).initialize()
(new RowCellsCell(i70, i71)).initialize()
(new RowCellsCell(i70, i72)).initialize()
(new RowCellsCell(i70, i73)).initialize()
(new RowCellsCell(i70, i74)).initialize()
(new RowCellsCell(i70, i75)).initialize()
(new RowCellsCell(i70, i76)).initialize()
(new CellPortPort(i71, i1)).initialize()
(new CellPortPort(i72, i2)).initialize()
(new CellPortPort(i73, i3)).initialize()
(new CellPortPort(i74, i4)).initialize()
(new CellPortPort(i75, i5)).initialize()
(new CellPortPort(i76, i6)).initialize()
(new RowCellsCell(i77, i78)).initialize()
(new RowCellsCell(i77, i79)).initialize()
(new RowCellsCell(i77, i80)).initialize()
(new RowCellsCell(i77, i81)).initialize()
(new RowCellsCell(i77, i82)).initialize()
(new RowCellsCell(i77, i83)).initialize()
(new CellPortPort(i78, i1)).initialize()
(new CellPortPort(i79, i2)).initialize()
(new CellPortPort(i80, i3)).initialize()
(new CellPortPort(i81, i4)).initialize()
(new CellPortPort(i82, i5)).initialize()
(new CellPortPort(i83, i6)).initialize()
(new RowCellsCell(i84, i85)).initialize()
(new RowCellsCell(i84, i86)).initialize()
(new RowCellsCell(i84, i87)).initialize()
(new RowCellsCell(i84, i88)).initialize()
(new RowCellsCell(i84, i89)).initialize()
(new RowCellsCell(i84, i90)).initialize()
(new CellPortPort(i85, i1)).initialize()
(new CellPortPort(i86, i2)).initialize()
(new CellPortPort(i87, i3)).initialize()
(new CellPortPort(i88, i4)).initialize()
(new CellPortPort(i89, i5)).initialize()
(new CellPortPort(i90, i6)).initialize()
(new RowCellsCell(i91, i92)).initialize()
(new RowCellsCell(i91, i93)).initialize()
(new RowCellsCell(i91, i94)).initialize()
(new RowCellsCell(i91, i95)).initialize()
(new RowCellsCell(i91, i96)).initialize()
(new RowCellsCell(i91, i97)).initialize()
(new CellPortPort(i92, i1)).initialize()
(new CellPortPort(i93, i2)).initialize()
(new CellPortPort(i94, i3)).initialize()
(new CellPortPort(i95, i4)).initialize()
(new CellPortPort(i96, i5)).initialize()
(new CellPortPort(i97, i6)).initialize()
(new RowCellsCell(i98, i99)).initialize()
(new RowCellsCell(i98, i100)).initialize()
(new RowCellsCell(i98, i101)).initialize()
(new RowCellsCell(i98, i102)).initialize()
(new RowCellsCell(i98, i103)).initialize()
(new RowCellsCell(i98, i104)).initialize()
(new CellPortPort(i99, i1)).initialize()
(new CellPortPort(i100, i2)).initialize()
(new CellPortPort(i101, i3)).initialize()
(new CellPortPort(i102, i4)).initialize()
(new CellPortPort(i103, i5)).initialize()
(new CellPortPort(i104, i6)).initialize()
(new RowCellsCell(i105, i106)).initialize()
(new RowCellsCell(i105, i107)).initialize()
(new RowCellsCell(i105, i108)).initialize()
(new RowCellsCell(i105, i109)).initialize()
(new RowCellsCell(i105, i110)).initialize()
(new RowCellsCell(i105, i111)).initialize()
(new CellPortPort(i106, i1)).initialize()
(new CellPortPort(i107, i2)).initialize()
(new CellPortPort(i108, i3)).initialize()
(new CellPortPort(i109, i4)).initialize()
(new CellPortPort(i110, i5)).initialize()
(new CellPortPort(i111, i6)).initialize()
(new RowCellsCell(i112, i113)).initialize()
(new RowCellsCell(i112, i114)).initialize()
(new RowCellsCell(i112, i115)).initialize()
(new RowCellsCell(i112, i116)).initialize()
(new RowCellsCell(i112, i117)).initialize()
(new RowCellsCell(i112, i118)).initialize()
(new CellPortPort(i113, i1)).initialize()
(new CellPortPort(i114, i2)).initialize()
(new CellPortPort(i115, i3)).initialize()
(new CellPortPort(i116, i4)).initialize()
(new CellPortPort(i117, i5)).initialize()
(new CellPortPort(i118, i6)).initialize()
//ModelElementLists.printAll()
SynchronizationCompartment.integrateNewModel(BdtSumIntegration)
println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")
//ModelElementLists.printFromPackage("BDD")
//ModelElementLists.printAll()
WriteSumBdtOutput.generateEverything(bddFileName)
validator.launch(ttFileName, bddFileName)
}
\ No newline at end of file
package ttc2019
import org.eclipse.emf.ecore.EObject
trait ICreateTruthTable {
def createTruthTable(name: String, id: Int): Unit
def createTruthTable(name: String, id: EObject): Unit
def createInputPort(name: String, id: Int): Unit
def createInputPort(name: String, id: EObject): Unit
def createOutputPort(name: String, id: Int): Unit
def createOutputPort(name: String, id: EObject): Unit
def createRow(id: Int): Unit
def createRow(id: EObject): Unit
def createCell(value: Boolean, id: Int): Unit
def createCell(value: Boolean, id: EObject): Unit
def createTruthTableRowsRow(tt: Int, row: Int): Unit
def createTruthTableRowsRow(tt: EObject, row: EObject): Unit
def createTruthTablePortsPort(tt: Int, port: Int): Unit
def createTruthTablePortsPort(tt: EObject, port: EObject): Unit
def createRowCellsCell(row: Int, cell: Int): Unit
def createRowCellsCell(row: EObject, cell: EObject): Unit
def createCellPortPort(cell: Int, port: Int): Unit
def createCellPortPort(cell: EObject, port: EObject): Unit
}
\ No newline at end of file
......@@ -9,23 +9,13 @@ object MetricMeasurement {
def printMetricsBDT(directly: Boolean = false): Metrics = {
printDirectly = directly
val bdd = ModelElementLists.getElementsFromType("sync.bdd.BDD").head.asInstanceOf[_root_.sync.bdd.BDD]
val numberSubtrees = ModelElementLists.getElementsFromType("sync.bdd.Subtree").size
val numberLeafs = ModelElementLists.getElementsFromType("sync.bdd.Leaf").size
var maxPath: Int = -1
var minPath: Int = -1
var sumDepth: Int = 0
ModelElementLists.getElementsFromType("sync.bdd.Leaf").asInstanceOf[List[sync.bdd.Leaf]].foreach(l => {
var depth = l.getMinDeep()
sumDepth += depth
if (depth > maxPath) {
maxPath = depth
}
if (depth < minPath || minPath == -1) {
minPath = depth
}
})
val averagePath: Double = sumDepth.toDouble / numberLeafs.toDouble
val maxPath = bdd.getTree().getMaxPath()
val minPath = bdd.getTree().getMinPath()
val averagePath = bdd.getTree().getAvgPath()
if (directly) {
println("Number Subtrees: " + numberSubtrees)
......@@ -39,25 +29,13 @@ object MetricMeasurement {
def printMetricsBDD(directly: Boolean = false): Metrics = {
printDirectly = directly
val bdd = ModelElementLists.getElementsFromType("sync.bddg.BDD").head.asInstanceOf[_root_.sync.bddg.BDD]
val numberSubtrees = ModelElementLists.getElementsFromType("sync.bddg.Subtree").size
val numberLeafs = ModelElementLists.getElementsFromType("sync.bddg.Leaf").size
var maxPath: Int = -1
var minPath: Int = -1
var sumDepth: Int = 0
var sumNodes: Int = 0
ModelElementLists.getElementsFromType("sync.bddg.Leaf").asInstanceOf[List[sync.bddg.Leaf]].foreach(l => {
var depth = l.getMinDeep()
sumNodes += l.getOwnerSubtreeForOne().size + l.getOwnerSubtreeForZero().size
sumDepth += l.getSumDeep()
if (depth > maxPath) {
maxPath = depth
}
if (depth < minPath || minPath == -1) {
minPath = depth
}
})
val averagePath: Double = sumDepth.toDouble / sumNodes.toDouble
val maxPath = bdd.getRoot().getMaxPath()
val minPath = bdd.getRoot().getMinPath()
val averagePath = bdd.getRoot().getAvgPath()
if (directly) {
println("Number Subtrees: " + numberSubtrees)
......
......
package ttc2019
import org.eclipse.emf.ecore.EObject
import org.eclipse.emf.ecore.EPackage
/**
* Save meta and instance model.
*
* @author Christopher Werner
*/
class TTCEmfSaver(val pkg: EPackage, val obj: EObject) {
}
\ No newline at end of file
......@@ -3,12 +3,15 @@ package ttc2019
import org.eclipse.emf.common.util.URI
import org.eclipse.emf.ecore.resource.Resource
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
import org.eclipse.emf.ecore.{ EObject, EPackage }
import org.eclipse.emf.ecore.xmi.XMLResource
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl
import scala.collection.JavaConverters._
import java.io.File
import org.eclipse.emf.ecore.EStructuralFeature
import ttc2019.metamodels.create._
import ttc2019.metamodels.tt._
/**
* Simple service to load an ECORE meta and instance model from a file.
......@@ -23,110 +26,119 @@ class TTCLoader {
* @param path where to find the model
* @return the model described by the XML
*/
def loadEcore(pathMeta: String, pathInstance: String): TTCEmfSaver = {
def javaLoadEcore(pathMeta: String, pathInstance: String): EObject = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
val resourceSet = new ResourceSetImpl()
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl())
val loader = new LoadEObject
return loader.load(pathMeta, pathInstance)
}
val res = resourceSet.getResource(URI.createFileURI(pathMeta), true)
def javaSimpleLoadEcore(pathMeta: String, pathInstance: String): EObject = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
require(null != res)
require(!res.getContents.isEmpty)
val loader = new LoadEObject
return loader.loadSimple(pathMeta, pathInstance)
}
val univEPackage = res.getContents().get(0);
resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", univEPackage);
val myModel = resourceSet.getResource(URI.createURI(pathInstance), true);
def javaTTfromEcore(pathMeta: String, pathInstance: String): TruthTable = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
return new TTCEmfSaver(res.getContents.toArray(new Array[EObject](0)).toList.find(_.isInstanceOf[EPackage]).map((p: EObject) => p.asInstanceOf[EPackage]).orNull,
myModel.getContents().toArray(new Array[EObject](0)).toList.head)
val loader = new LoadEObject
return loader.loadTT(pathMeta, pathInstance)
}
/**
* Create the input TruthTable instance from the *.ttmodel file.
*/
def createTruthTableInstance(clsins: TTCEmfSaver, ctts: ICreateTruthTable): Unit = {
//println("++++++++++++++++++++++++++++++++++++++++++++++")
val contents = clsins.obj.eAllContents().asScala
var counter = 0
var ecoreMap: Map[EObject, Int] = Map.empty
var objName = clsins.obj.eClass.getName
def scalaLoadEcore(pathMeta: String, pathInstance: String): EObject = {
require(null != pathMeta && pathMeta.nonEmpty && null != pathInstance && pathInstance.nonEmpty)
//println(objName)
objName match {
case "TruthTable" => ctts.createTruthTable(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("name")).toString(), counter)
case "InputPort" => ctts.createInputPort(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("name")).toString(), counter)
case "OutputPort" => ctts.createOutputPort(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("name")).toString(), counter)
case "Row" => ctts.createRow(counter)
case "Cell" => ctts.createCell(clsins.obj.eGet(clsins.obj.eClass().getEStructuralFeature("value")).asInstanceOf[Boolean], counter)
case _ =>
val resourceSet = new ResourceSetImpl();
/*resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true.asInstanceOf[Object]);
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, true.asInstanceOf[Object]);
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true.asInstanceOf[Object])
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put("ecore", new EcoreResourceFactoryImpl())
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put("ttmodel", new IntrinsicIDXMIResourceFactoryImpl())*/
resourceSet.getResourceFactoryRegistry.getExtensionToFactoryMap.put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl())
val ressourceMeta = resourceSet.getResource(URI.createFileURI(pathMeta), true)
val packageMeta = ressourceMeta.getContents().get(0)
require(null != ressourceMeta)
require(!ressourceMeta.getContents.isEmpty)
resourceSet.getPackageRegistry().put("https://www.transformation-tool-contest.eu/2019/tt", packageMeta);
val ressourceModel = resourceSet.getResource(URI.createURI(pathInstance), true);
return ressourceModel.getContents().get(0)
}
ecoreMap += (clsins.obj -> counter)
counter += 1
contents.foreach(o => {
var objName = o.eClass().getName
private def createObj(obj: EObject, ctts: ICreateTruthTable): Unit = {
var objName = obj.eClass.getName
//println(objName)
objName match {
case "TruthTable" => {
/*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala
structs.foreach(a => {
println("AName: " + a.getName)
})*/
ctts.createTruthTable(o.eGet(o.eClass().getEStructuralFeature("name")).toString(), counter)
}
case "InputPort" => {
/*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala
structs.foreach(a => {
println("AName: " + a.getName)
})*/
ctts.createInputPort(o.eGet(o.eClass().getEStructuralFeature("name")).toString(), counter)
}
case "OutputPort" => {
/*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala
structs.foreach(a => {
println("AName: " + a.getName)
})*/
ctts.createOutputPort(o.eGet(o.eClass().getEStructuralFeature("name")).toString(), counter)
}
case "Row" => {
/*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala
structs.foreach(a => {
println("AName: " + a.getName)
})*/
ctts.createRow(counter)
}
case "Cell" => {
/*var structs: Seq[EStructuralFeature] = o.eClass().getEAllStructuralFeatures.asScala
structs.foreach(a => {
println("AName: " + a.getName)
})*/
ctts.createCell(o.eGet(o.eClass().getEStructuralFeature("value")).asInstanceOf[Boolean], counter)
}
case "TruthTable" => ctts.createTruthTable(obj.eGet(obj.eClass().getEStructuralFeature("name")).toString(), obj)
case "InputPort" => ctts.createInputPort(obj.eGet(obj.eClass().getEStructuralFeature("name")).toString(), obj)
case "OutputPort" => ctts.createOutputPort(obj.eGet(obj.eClass().getEStructuralFeature("name")).toString(), obj)
case "Row" => ctts.createRow(obj)
case "Cell" => ctts.createCell(obj.eGet(obj.eClass().getEStructuralFeature("value")).asInstanceOf[Boolean], obj)
case _ =>
}
ecoreMap += (o -> counter)
counter += 1
})
//add values for instances
ecoreMap.keySet.foreach(o1 => {
}
private def createReferences(o1: EObject, ctts: ICreateTruthTable): Unit = {
o1.eClass().getEAllReferences.forEach(sf => {
if (sf.getName == "port" || sf.getName == "owner") {
val o2 = o1.eGet(sf).asInstanceOf[EObject]
//println("++ " + o1.eClass().getName + " " + sf.getName + " " + o2.eClass().getName)
if (o1.eClass().getName == "Cell" && sf.getName == "port" && o2.eClass().getName.contains("Port")) {
ctts.createCellPortPort(ecoreMap.get(o1).get, ecoreMap.get(o2).get)
ctts.createCellPortPort(o1, o2)
} else if (o1.eClass().getName == "Cell" && sf.getName == "owner" && o2.eClass().getName == "Row") {
ctts.createRowCellsCell(o2, o1)
} else if (o1.eClass().getName.contains("Port") && sf.getName == "owner" && o2.eClass().getName == "TruthTable") {
ctts.createTruthTablePortsPort(o2, o1)
} else if (o1.eClass().getName == "Row" && sf.getName == "owner" && o2.eClass().getName == "TruthTable") {
ctts.createTruthTableRowsRow(o2, o1)
}
if (o1.eClass().getName == "Cell" && sf.getName == "owner" && o2.eClass().getName == "Row") {
ctts.createRowCellsCell(ecoreMap.get(o2).get, ecoreMap.get(o1).get)
}
if (o1.eClass().getName.contains("Port") && sf.getName == "owner" && o2.eClass().getName == "TruthTable") {
ctts.createTruthTablePortsPort(ecoreMap.get(o2).get, ecoreMap.get(o1).get)
})
}
if (o1.eClass().getName == "Row" && sf.getName == "owner" && o2.eClass().getName == "TruthTable") {
ctts.createTruthTableRowsRow(ecoreMap.get(o2).get, ecoreMap.get(o1).get)
/**
* Create the input TruthTable instance from the *.ttmodel file.
*/
def createTruthTableInstance(obj: EObject, ctts: ICreateTruthTable): Unit = {
createObj(obj, ctts)
obj.eAllContents().asScala.foreach(o => {
createObj(o, ctts)
})
//add values for instances
createReferences(obj, ctts)
obj.eAllContents().asScala.foreach(o1 => {
createReferences(o1, ctts)
})
}
def createTruthTableRSYNCInstance(tt: TruthTable, cttss: ICreateTruthTable): Unit = {
val ctts = new CreateTTinJava()
ctts.createTruthTable(tt.getName, tt)
tt.getPorts.forEach(p => {
if (p.isInstanceOf[InputPort]) {
ctts.createInputPort(p.getName, p)
} else {
ctts.createOutputPort(p.getName, p)
}
ctts.createTruthTablePortsPort(tt, p)
})
tt.getRows.forEach(r => {
ctts.createRow(r)
ctts.createTruthTableRowsRow(tt, r)
r.getCells.forEach(c => {
ctts.createCell(c.isValue(), c)
ctts.createRowCellsCell(r, c)
ctts.createCellPortPort(c, c.getPort)
})
})
}
......
......
package ttc2019
import sync.tt._
object TTFactory {
def getInputPort(name: String) = new InputPort(name, Set.empty, null, null)
def getTruthTable(name: String) = new TruthTable(name, Set.empty, Set.empty, null)
def getOutputPort(name: String) = new OutputPort(name, Set.empty, null, null)
def getRow() = new Row(Set.empty, null, null)
def getCell(value: Boolean) = new Cell(value, null, null, null)
}
\ No newline at end of file
package ttc2019
import bdd.BDD
import bdd.InputPort
import bdd.OutputPort
import bdd.Assignment
import bdd.Leaf
import bdd.Subtree
import bdd.AssignmentPortOutputPort
import bdd.BDDPortsPort
import bdd.BDDTreeTree
import bdd.LeafAssignmentsAssignment
import bdd.SubtreePortInputPort
import bdd.SubtreeTreeForOneTree
import bdd.SubtreeTreeForZeroTree
import ttc2019.metamodels.create.CreationHelper
import org.rosi_project.model_management.core.ModelElementLists
object WriteOutput {
def generateEverything(outputFile: String): Unit = {
val creation = new CreationHelper()
val bd = ModelElementLists.getDirectElementsFromType("bdd.BDD").asInstanceOf[List[BDD]]
val in = ModelElementLists.getDirectElementsFromType("bdd.InputPort").asInstanceOf[List[InputPort]]
val ou = ModelElementLists.getDirectElementsFromType("bdd.OutputPort").asInstanceOf[List[OutputPort]]
val as = ModelElementLists.getDirectElementsFromType("bdd.Assignment").asInstanceOf[List[Assignment]]
val le = ModelElementLists.getDirectElementsFromType("bdd.Leaf").asInstanceOf[List[Leaf]]
val su = ModelElementLists.getDirectElementsFromType("bdd.Subtree").asInstanceOf[List[Subtree]]
val apo = ModelElementLists.getDirectElementsFromType("bdd.AssignmentPortOutputPort").asInstanceOf[List[AssignmentPortOutputPort]]
val bpp = ModelElementLists.getDirectElementsFromType("bdd.BDDPortsPort").asInstanceOf[List[BDDPortsPort]]
val btt = ModelElementLists.getDirectElementsFromType("bdd.BDDTreeTree").asInstanceOf[List[BDDTreeTree]]
val laa = ModelElementLists.getDirectElementsFromType("bdd.LeafAssignmentsAssignment").asInstanceOf[List[LeafAssignmentsAssignment]]
val spi = ModelElementLists.getDirectElementsFromType("bdd.SubtreePortInputPort").asInstanceOf[List[SubtreePortInputPort]]
val szt = ModelElementLists.getDirectElementsFromType("bdd.SubtreeTreeForZeroTree").asInstanceOf[List[SubtreeTreeForZeroTree]]
val sot = ModelElementLists.getDirectElementsFromType("bdd.SubtreeTreeForOneTree").asInstanceOf[List[SubtreeTreeForOneTree]]
/*println(bd)
println(in)
println(ou)
println(as)
println(le)
println(su)
println(apo)
println(bpp)
println(btt)
println(laa)
println(spi)
println(szt)
println(sot) */
//add normal instances
bd.foreach(o => {
creation.createBDD(o, o.getName())
})
in.foreach(o => {
creation.createInputPort(o, o.getName())
})
ou.foreach(o => {
creation.createOutputPort(o, o.getName())
})
as.foreach(o => {
creation.createAssignment(o, o.getValue())
})
le.foreach(o => {
creation.createLeaf(o)
})
su.foreach(o => {
creation.createSubtree(o)
})
var setLeafs: Set[Leaf] = Set.empty
var setAssignment: Set[Assignment] = Set.empty
//add connections
bpp.foreach(o => {
creation.addBDDPortConnection(o.getTargetIns())
})
btt.foreach(o => {
creation.addBDDTreeConnection(o.getTargetIns())
if (o.getTargetIns().isInstanceOf[Leaf]) {
setLeafs += o.getTargetIns().asInstanceOf[Leaf]
}
})
spi.foreach(o => {
creation.addInputSubtreeConnection(o.getTargetIns(), o.getSourceIns())
})
szt.foreach(o => {
creation.addSubtreeZeroTreeConnection(o.getTargetIns(), o.getSourceIns())
if (o.getTargetIns().isInstanceOf[Leaf]) {
setLeafs += o.getTargetIns().asInstanceOf[Leaf]
}
})
sot.foreach(o => {
creation.addSubtreeOneTreeConnection(o.getTargetIns(), o.getSourceIns())
if (o.getTargetIns().isInstanceOf[Leaf]) {
setLeafs += o.getTargetIns().asInstanceOf[Leaf]
}
})
laa.filter(o => setLeafs.contains(o.getSourceIns())).foreach(o => {
creation.addLeafAssignmentConnection(o.getSourceIns(), o.getTargetIns())
setAssignment += o.getTargetIns()
})
//critical only push assignments that are connected
apo.filter(o => setAssignment.contains(o.getSourceIns())).foreach(o => {
creation.addOutputAssignmentConnection(o.getTargetIns(), o.getSourceIns())
})
//generate output file
creation.generate(outputFile)
}
}
\ No newline at end of file
package ttc2019
package ttc2019.worksum
import org.rosi_project.model_management.core._
import org.rosi_project.model_management.sync.IIntegrationCompartment
......
......
package ttc2019
package ttc2019.worksum
import sum.tt._
import org.eclipse.emf.ecore.EObject
import ttc2019.ICreateTruthTable
class CreateTruthTableSum extends ICreateTruthTable {
var mapping: Map[Int, Object] = Map.empty
var mapping: Map[EObject, Object] = Map.empty
def createTruthTable(name: String, id: Int): Unit = {
def createTruthTable(name: String, id: EObject): Unit = {
mapping = mapping + (id -> new TruthTable(name, null))
}
def createInputPort(name: String, id: Int): Unit = {
def createInputPort(name: String, id: EObject): Unit = {
mapping = mapping + (id -> new InputPort(name, null))
}
def createOutputPort(name: String, id: Int): Unit = {
def createOutputPort(name: String, id: EObject): Unit = {
mapping = mapping + (id -> new OutputPort(name, null))
}
def createRow(id: Int): Unit = {
def createRow(id: EObject): Unit = {
mapping = mapping + (id -> new Row(null))
}
def createCell(value: Boolean, id: Int): Unit = {
def createCell(value: Boolean, id: EObject): Unit = {
mapping = mapping + (id -> new Cell(value, null))
}
def createTruthTableRowsRow(tt: Int, row: Int): Unit = {
def createTruthTableRowsRow(tt: EObject, row: EObject): Unit = {
(new TruthTableRowsRow(mapping.get(tt).get.asInstanceOf[TruthTable], mapping.get(row).get.asInstanceOf[Row])).initialize()
}
def createTruthTablePortsPort(tt: Int, port: Int): Unit = {
def createTruthTablePortsPort(tt: EObject, port: EObject): Unit = {
(new TruthTablePortsPort(mapping.get(tt).get.asInstanceOf[TruthTable], mapping.get(port).get.asInstanceOf[Port])).initialize()
}
def createRowCellsCell(row: Int, cell: Int): Unit = {
def createRowCellsCell(row: EObject, cell: EObject): Unit = {
(new RowCellsCell(mapping.get(row).get.asInstanceOf[Row], mapping.get(cell).get.asInstanceOf[Cell])).initialize()
}
def createCellPortPort(cell: Int, port: Int): Unit = {
def createCellPortPort(cell: EObject, port: EObject): Unit = {
(new CellPortPort(mapping.get(cell).get.asInstanceOf[Cell], mapping.get(port).get.asInstanceOf[Port])).initialize()
}
}
\ No newline at end of file
package ttc2019
package ttc2019.worksum
import org.rosi_project.model_management.sync.ISyncCompartment
import org.rosi_project.model_management.sync.roles.ISyncRole
......
......
package ttc2019
package ttc2019.worksum
import org.rosi_project.model_management.sync.ISyncCompartment
import org.rosi_project.model_management.sync.roles.ISyncRole
......
......
package ttc2019
package ttc2019.worksum
import org.rosi_project.model_management.sync.ISyncCompartment
import org.rosi_project.model_management.sync.roles.ISyncRole
......
......
package ttc2019
package ttc2019.worksum
import org.rosi_project.model_management.sync.IConstructionCompartment
import org.rosi_project.model_management.sync.roles.IConstructor
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment