diff options
author | michelou <michelou@epfl.ch> | 2007-05-03 12:43:50 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-05-03 12:43:50 +0000 |
commit | b927a915b08b38888ea52c2433ff9376bcf33a83 (patch) | |
tree | 202a5d215578245f4a43691f57d63fa251f5de80 /src/actors | |
parent | 97caf77483fa29a81068a9b37da999e49bed016c (diff) | |
download | scala-b927a915b08b38888ea52c2433ff9376bcf33a83.tar.gz scala-b927a915b08b38888ea52c2433ff9376bcf33a83.tar.bz2 scala-b927a915b08b38888ea52c2433ff9376bcf33a83.zip |
updated Scala comments (code examples, links, o...
updated Scala comments (code examples, links, overrides)
Diffstat (limited to 'src/actors')
-rw-r--r-- | src/actors/scala/actors/Actor.scala | 25 | ||||
-rw-r--r-- | src/actors/scala/actors/ActorProxy.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/Channel.scala | 12 | ||||
-rw-r--r-- | src/actors/scala/actors/Future.scala | 28 | ||||
-rw-r--r-- | src/actors/scala/actors/Reaction.scala | 20 | ||||
-rw-r--r-- | src/actors/scala/actors/remote/RemoteActor.scala | 79 |
6 files changed, 94 insertions, 74 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala index 1580960869..8aa465e104 100644 --- a/src/actors/scala/actors/Actor.scala +++ b/src/actors/scala/actors/Actor.scala @@ -262,13 +262,22 @@ object Actor { * implementation of event-based actors. * </p> * <p> - * The main ideas of our approach are explained in the papers<br> - * <b>Event-Based Programming without Inversion of Control</b>, - * Philipp Haller and Martin Odersky, <i>Proc. JMLC 2006</i> - * <br><br> - * <b>Actors that Unify Threads and Events</b>, - * Philipp Haller and Martin Odersky, <i>LAMP-REPORT-2007-001, EPFL</i> + * The main ideas of our approach are explained in the two papers * </p> + * <ul> + * <li> + * <a href="http://lampwww.epfl.ch/~odersky/papers/jmlc06.pdf"> + * <span style="font-weight:bold; white-space:nowrap;">Event-Based + * Programming without Inversion of Control</span></a>,<br/> + * Philipp Haller and Martin Odersky, <i>Proc. JMLC 2006</i>, and + * </li> + * <li> + * <a href="http://www.scala-lang.org/docu/files/haller07actorsunify.pdf"> + * <span style="font-weight:bold; white-space:nowrap;">Actors that + * Unify Threads and Events</span></a>,<br/> + * Philipp Haller and Martin Odersky, <i>LAMP-REPORT-2007-001, EPFL</i>. + * </li> + * </ul> * * @version 0.9.6 * @author Philipp Haller @@ -730,9 +739,9 @@ trait Actor extends OutputChannel[Any] { /** <p> * This object is used as the timeout pattern in - * <a href="Actor.html#receiveWithin(scala.Long)" target="contentFrame"> + * <a href="Actor.html#receiveWithin(Long)" target="contentFrame"> * <code>receiveWithin</code></a> and - * <a href="Actor.html#reactWithin(scala.Long)" target="contentFrame"> + * <a href="Actor.html#reactWithin(Long)" target="contentFrame"> * <code>reactWithin</code></a>. * </p> * <p> diff --git a/src/actors/scala/actors/ActorProxy.scala b/src/actors/scala/actors/ActorProxy.scala index 9c9626c8d6..5d6198fe96 100644 --- a/src/actors/scala/actors/ActorProxy.scala +++ b/src/actors/scala/actors/ActorProxy.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** ** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -15,7 +15,7 @@ package scala.actors import java.lang.Thread /** - * The class <code>ActorProxy</code>provides a dynamic actor proxy for normal + * The class <code>ActorProxy</code> provides a dynamic actor proxy for normal * Java threads. * * @version 0.9.6 diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala index 51b1c30a21..52386c9b70 100644 --- a/src/actors/scala/actors/Channel.scala +++ b/src/actors/scala/actors/Channel.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -20,8 +20,8 @@ package scala.actors * The following example demonstrates its usage: * </p><pre> * receive { - * case Chan1 ! msg1 => ... - * case Chan2 ! msg2 => ... + * <b>case</b> Chan1 ! msg1 => ... + * <b>case</b> Chan2 ! msg2 => ... * } * </pre> * @@ -55,7 +55,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] { * * @param msg the message to be sent */ - def !(msg: Msg): unit = { + def !(msg: Msg) { receiver ! scala.actors.!(this, msg) } @@ -63,7 +63,7 @@ class Channel[Msg] extends InputChannel[Msg] with OutputChannel[Msg] { * Forwards <code>msg</code> to <code>this</code> keeping the * last sender as sender instead of <code>self</code>. */ - def forward(msg: Msg): unit = { + def forward(msg: Msg) { receiver forward scala.actors.!(this, msg) } diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index 3cbe9507ef..66f6e7d163 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -11,14 +11,18 @@ package scala.actors /** - * A Future is a function of arity 0 that returns a value of type Any. - * Applying a future blocks the current actor until its value - * is available. - * A future can be queried to find out whether its value - * is already available. + * <p> + * A Future is a function of arity 0 that returns a value of type Any. + * Applying a future blocks the current actor until its value + * is available. + * </p> + * <p> + * A future can be queried to find out whether its value + * is already available. + * </p> * - * @version 0.9.6 * @author Philipp Haller + * @version 0.9.6 */ abstract class Future[T](val ch: InputChannel[Any]) extends Function0[T] { protected var value: Option[T] = None @@ -26,7 +30,7 @@ abstract class Future[T](val ch: InputChannel[Any]) extends Function0[T] { } /** - * The Futures object contains methods that operate on Futures. + * The <code>Futures</code> object contains methods that operate on Futures. * * @version 0.9.6 * @author Philipp Haller @@ -58,9 +62,13 @@ object Futures { } /** - * Awaits all futures returning an option containing a list of replies, - * or timeouts returning None. - * Note that some of the futures might already have been awaited. + * <p> + * Awaits all futures returning an option containing a list of replies, + * or timeouts returning <code>None</code>. + * </p> + * <p> + * Note that some of the futures might already have been awaited. + * </p> */ def awaitAll(timeout: long, fts: Future[Any]*): List[Option[Any]] = { var resultsMap: collection.mutable.Map[Int, Option[Any]] = new collection.mutable.HashMap[Int, Option[Any]] diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala index f5d67bc1e1..a6eaa18833 100644 --- a/src/actors/scala/actors/Reaction.scala +++ b/src/actors/scala/actors/Reaction.scala @@ -19,18 +19,20 @@ import java.lang.{InterruptedException, Runnable} * return type <code>Nothing</code>. * </p> * - * @version 0.9.6 - * @author Philipp Haller + * @version 0.9.6 + * @author Philipp Haller */ private[actors] class ExitActorException extends Throwable -/** - * The abstract class <code>Reaction</code> associates - * an instance of an <code>Actor</code> with a - * <code>java.lang.Runnable</code>. +/** <p> + * The abstract class <code>Reaction</code> associates + * an instance of an <code>Actor</code> with a + * <a class="java/lang/Runnable" href="" target="contentFrame"> + * <code>java.lang.Runnable</code></a>. + * </p> * - * @version 0.9.6 - * @author Philipp Haller + * @version 0.9.6 + * @author Philipp Haller */ private[actors] class Reaction(a: Actor, f: PartialFunction[Any, Unit], @@ -39,7 +41,7 @@ private[actors] class Reaction(a: Actor, def actor = a - def run(): Unit = { + def run() { val saved = Actor.tl.get.asInstanceOf[Actor] Actor.tl.set(a) Scheduler.unPendReaction diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala index 81c9cea3d0..b30e363b46 100644 --- a/src/actors/scala/actors/remote/RemoteActor.scala +++ b/src/actors/scala/actors/remote/RemoteActor.scala @@ -1,7 +1,7 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2005-2006, LAMP/EPFL ** -** __\ \/ /__/ __ |/ /__/ __ | ** +** / __/ __// _ | / / / _ | (c) 2005-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** \* */ @@ -12,32 +12,33 @@ package scala.actors.remote -/** - This object provides methods for creating, registering, and - selecting remotely accessible actors. - - A remote actor is typically created like this: - <pre> - actor { - alive(9010) - register('myName, self) - - // behavior - } - </pre> - - It can be accessed by an actor running on a (possibly) - different node by selecting it in the following way: - <pre> - actor { - // ... - <b>val</b> c = select(TcpNode("127.0.0.1", 9010), 'myName) - c ! msg - // ... - } - </pre> - - @author Philipp Haller +/** <p> + * This object provides methods for creating, registering, and + * selecting remotely accessible actors. + * </p> + * <p> + * A remote actor is typically created like this: + * </p><pre> + * actor { + * alive(9010) + * register('myName, self) + * + * // behavior + * } + * </pre> + * <p> + * It can be accessed by an actor running on a (possibly) + * different node by selecting it in the following way: + * </p><pre> + * actor { + * // ... + * <b>val</b> c = select(TcpNode("127.0.0.1", 9010), 'myName) + * c ! msg + * // ... + * } + * </pre> + * + * @author Philipp Haller */ object RemoteActor { @@ -47,7 +48,7 @@ object RemoteActor { * Makes <code>self</code> remotely accessible on TCP port * <code>port</code>. */ - def alive(port: int): Unit = { + def alive(port: int) { val serv = new TcpService(port) serv.start() kernels += Actor.self -> serv.kernel @@ -57,15 +58,15 @@ object RemoteActor { * Registers <code>a</code> under <code>name</code> on this * node. */ - def register(name: Symbol, a: Actor): Unit = { + def register(name: Symbol, a: Actor) { val kernel = kernels.get(Actor.self) match { - case None => { + case None => val serv = new TcpService(TcpService.generatePort) serv.start() kernels += Actor.self -> serv.kernel serv.kernel - } - case Some(k) => k + case Some(k) => + k } kernel.register(name, a) } @@ -76,22 +77,22 @@ object RemoteActor { */ def select(node: Node, sym: Symbol): Actor = new Actor { - def act(): Unit = {} + def act() {} override def !(msg: Any): Unit = msg match { - case a: AnyRef => { + case a: AnyRef => // establish remotely accessible // return path (sender) val kernel = kernels.get(Actor.self) match { - case None => { + case None => val serv = new TcpService(TcpService.generatePort) serv.start() kernels += Actor.self -> serv.kernel serv.kernel - } - case Some(k) => k + case Some(k) => + k } kernel.send(node, sym, a) - } + case other => error("Cannot send non-AnyRef value remotely.") } |