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

3
import de.tum.workflows.blocks._
Christian Müller's avatar
Christian Müller committed
4
5
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
  
   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()
     }
   }
  
20
21
  def allchoices(w: Workflow) = {
    w.steps flatMap (collectChoices _) toSet
Christian Müller's avatar
Christian Müller committed
22
  }
Christian Müller's avatar
Christian Müller committed
23
}