Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2014
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.10 KB | None | 0 0
  1. import subscript.DSL._
  2. import subscript.Predef._
  3. import subscript.vm._
  4. import subscript._
  5. import subscript.swing.Scripts._
  6. import akka.actor._
  7.  
  8. object Test {
  9.  
  10.   class Ping(another: ActorRef) extends Actor {
  11.    
  12.     override def receive: PartialFunction[Any, Unit] = {case _ =>}
  13.    
  14.     another ! "Hello"
  15.     another ! "Hello"
  16.     another ! "Terminal"
  17.   }
  18.  
  19.   class Pong extends SubScriptActor {
  20.    
  21.     def script live = ((receiveRegular ...) || receiveTerminal) ; over
  22.      
  23.     def script receiveRegular =
  24.       @{
  25.          val r: Actor.Receive = {
  26.            case "Hello" => println("Hello")
  27.          }
  28.          initActor(there, r)
  29.        }: {. .}
  30.    
  31.     def script receiveTerminal =
  32.       @{
  33.          val r: Actor.Receive = {
  34.            case "Terminal" => println("Terminal")
  35.          }
  36.          initActor(there, r)
  37.       }: {. .}
  38.      
  39.     def script over = {println("Over")}
  40.      
  41.    
  42.   }
  43.  
  44.   def main(args: Array[String]) {
  45.     val as = ActorSystem()
  46.    
  47.     val pong = as actorOf Props[Pong]
  48.     val ping = as actorOf Props(classOf[Ping], pong)
  49.   }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement