From 92ffe5c7edb4c21ed6864662cee642421d44c7e0 Mon Sep 17 00:00:00 2001
From: Rico Bergmann <rico.bergmann1@tu-dresden.de>
Date: Thu, 20 Jun 2019 21:03:04 +0200
Subject: [PATCH] [RSYNC] Document different processing modes

---
 .../scala/ttc2019/CompleteTTCProcess.scala    | 62 ++++++++-----------
 .../src/main/scala/ttc2019/ProcessMode.scala  | 22 ++++++-
 .../ttc2019/TTCProcessConfiguration.scala     |  1 +
 3 files changed, 49 insertions(+), 36 deletions(-)

diff --git a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala
index a15e71b..cea1df9 100644
--- a/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala
+++ b/solutions/RSync/src/main/scala/ttc2019/CompleteTTCProcess.scala
@@ -9,10 +9,9 @@ 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
@@ -26,11 +25,10 @@ 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
@@ -54,41 +52,35 @@ object CompleteTTCProcess extends App {
     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 writeBdd(): 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()
@@ -99,7 +91,7 @@ object CompleteTTCProcess extends App {
   }
 
   override def main(args: Array[String]): Unit = {
-    val processConfig = TTCProcessConfiguration(ttFileName = "TT.ttmodel", bddFileName = "Generated.bddmodel")
+    val processConfig = TTCProcessConfiguration(ttFileName = "TT.ttmodel", bddFileName = "Generated.bddmodel", processMode = ProcessMode.BDT)
     executeEntireProcess(processConfig)
   }
 
diff --git a/solutions/RSync/src/main/scala/ttc2019/ProcessMode.scala b/solutions/RSync/src/main/scala/ttc2019/ProcessMode.scala
index 413540d..0bed596 100644
--- a/solutions/RSync/src/main/scala/ttc2019/ProcessMode.scala
+++ b/solutions/RSync/src/main/scala/ttc2019/ProcessMode.scala
@@ -1,6 +1,26 @@
 package ttc2019
 
+/** The `ProcessMode` describes the strategy that should be used in order to create the equivalent
+  * binary decision tree or binary decision diagram.
+  */
 object ProcessMode extends Enumeration {
   type ProcessMode = Value
-  val BDT, BDTU, BDD, BDDU = Value
+
+  /** A default binary decision tree should be generated.
+    */
+  val BDT,
+
+  /** A binary decision tree should be generated but the input ports may be visited in any
+    * order.
+    */
+  BDTU,
+
+  /** A binary decision diagram should be generated.
+    */
+  BDD,
+
+  /** A binary decision diagram should be generated and the input ports may be visited in any
+    * order.
+    */
+  BDDU = Value
 }
diff --git a/solutions/RSync/src/main/scala/ttc2019/TTCProcessConfiguration.scala b/solutions/RSync/src/main/scala/ttc2019/TTCProcessConfiguration.scala
index de2868c..f0a0d24 100644
--- a/solutions/RSync/src/main/scala/ttc2019/TTCProcessConfiguration.scala
+++ b/solutions/RSync/src/main/scala/ttc2019/TTCProcessConfiguration.scala
@@ -11,6 +11,7 @@ import ttc2019.ProcessMode.ProcessMode
   *   - `bddFileName` references the name (i.e. path) of the file where the generated binary
   *     decision diagram should be stored
   *   - `ttEcoreName` references the path to the truth table EMF model
+  *   - `processMode` sets the strategy to use for generating the binary decision tree / diagram
   */
 case class TTCProcessConfiguration(ttFileName: String, bddFileName: String, ttEcoreName: String = "TT.ecore", processMode: ProcessMode)
 
-- 
GitLab