Created
August 30, 2012 12:32
-
-
Save alinpopa/3527590 to your computer and use it in GitHub Desktop.
test2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.test.uml | |
case class Object(name: String) { | |
def --(message: String) = (this, message) | |
def <--(message: String) = (this, message) | |
} | |
sealed trait Action | |
sealed case class Call(source: Object, verb: String, destination: Object) extends Action | |
sealed case class Async(source: Object, verb: String, destination: Object) extends Action | |
object implicits { | |
class Sourceable(source: Object, action: String) { | |
def -->(target: Object) = Call(source, action, target) | |
def <--(target: Object) = Call(target, action, source) | |
} | |
implicit def toSourceable(tuple: (Object, String)) = new Sourceable(tuple._1, tuple._2) | |
} | |
object Uml { | |
import implicits._ | |
def main(args: Array[String]): Unit = { | |
val bob = Object("Bob") | |
val dan = Object("Dan") | |
println(List( | |
bob -- "salutes" --> dan, | |
dan -- "respondes" <-- bob | |
)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment