Utils.scala 619 Bytes
Newer Older
Christian Müller's avatar
Christian Müller committed
1 2
package de.tum.workflows

Christian Müller's avatar
Christian Müller committed
3 4 5
import de.tum.workflows.blocks.Workflow._
import de.tum.workflows.foltl.FOLTL._

Christian Müller's avatar
Christian Müller committed
6 7 8 9 10
object Utils {
  
  def mkString[T](string: Iterable[T], start: String, mid: String, end:String) = {
    if (string.isEmpty) "" else string.mkString(start, mid, end)
  }
Christian Müller's avatar
Christian Müller committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24
  
   def collectChoices(w: Block):List[Fun] = {
     w match {
       case Loop(steps) => steps.flatMap(collectChoices _)
       case ForallMayBlock(agents, pred, _) => List(Fun(pred, agents))
       case b:ForallBlock => List()
     }
   }
  
  def allchoices(w: Workflow):List[Fun] = {
    
    w.steps.flatMap(collectChoices _)
    
  }
Christian Müller's avatar
Christian Müller committed
25
}