This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

TransitionSystemFiddle.scala 1.32 KB
Newer Older
1 2 3
package de.bbisping.coupledsim.tool

import scala.scalajs.js.JSApp
4
import scala.scalajs.js.annotation.JSExportTopLevel
5 6 7 8 9 10 11 12 13 14
import de.bbisping.coupledsim.tool.arch.Action
import de.bbisping.coupledsim.tool.arch.ActionDispatcher
import de.bbisping.coupledsim.tool.arch.Control
import de.bbisping.coupledsim.tool.control.Samples
import de.bbisping.coupledsim.tool.control.Source
import de.bbisping.coupledsim.tool.control.Structure
import de.bbisping.coupledsim.tool.view.GraphRenderer
import de.bbisping.coupledsim.tool.view.SourceEditor
import de.bbisping.coupledsim.tool.control.Pipeline

15
@JSExportTopLevel("TransitionSystemFiddle")
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
object TransitionSystemFiddle extends JSApp with Control with ActionDispatcher {
  
  val source = new Source(this)
  val structure = new Structure(this)
  val pipeline = new Pipeline(this)
  
  val renderer = new GraphRenderer(this)
  val editor = new SourceEditor(this)
  
  def main(): Unit = {
    source.init()
    structure.init()
    val initialCode =
      Samples.getExample(editor.getURLSampleSlug())
      .map(_.code)
      .getOrElse(Samples.default)
    doAction(Source.LoadDefinition(initialCode), source)
  }
  
  def getActionTarget(a: Action) = a match {
    case _: Source.SourceAction => source
    case _: Structure.StructureAction => structure
    case _: Pipeline.PipelineAction => pipeline
  }
  
}