summaryrefslogtreecommitdiff
path: root/src/actors
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-12-22 20:11:29 +0000
committerPaul Phillips <paulp@improving.org>2009-12-22 20:11:29 +0000
commit361a7a40d35e09d7f622fcafd28531172a139e0e (patch)
tree53047ba64d5b56cc75b8b67500ad346c398437d6 /src/actors
parentd32b5bc758e9203ed66b2517d2abc2530385c1dc (diff)
downloadscala-361a7a40d35e09d7f622fcafd28531172a139e0e.tar.gz
scala-361a7a40d35e09d7f622fcafd28531172a139e0e.tar.bz2
scala-361a7a40d35e09d7f622fcafd28531172a139e0e.zip
Took full advantage of the new =>? alias for th...
Took full advantage of the new =>? alias for the superverbosely named PartialFunction by renaming every usage of the latter except when in comments.
Diffstat (limited to 'src/actors')
-rw-r--r--src/actors/scala/actors/Actor.scala30
-rw-r--r--src/actors/scala/actors/Channel.scala8
-rw-r--r--src/actors/scala/actors/Future.scala6
-rw-r--r--src/actors/scala/actors/InputChannel.scala8
-rw-r--r--src/actors/scala/actors/ReactChannel.scala8
-rw-r--r--src/actors/scala/actors/Reaction.scala2
-rw-r--r--src/actors/scala/actors/Reactor.scala8
-rw-r--r--src/actors/scala/actors/Replyable.scala2
-rw-r--r--src/actors/scala/actors/ReplyableActor.scala8
-rw-r--r--src/actors/scala/actors/ReplyableReactor.scala2
-rw-r--r--src/actors/scala/actors/remote/Proxy.scala2
11 files changed, 42 insertions, 42 deletions
diff --git a/src/actors/scala/actors/Actor.scala b/src/actors/scala/actors/Actor.scala
index 625b19ebdd..fb90cb9c46 100644
--- a/src/actors/scala/actors/Actor.scala
+++ b/src/actors/scala/actors/Actor.scala
@@ -160,7 +160,7 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return the result of processing the received message
*/
- def receive[A](f: PartialFunction[Any, A]): A =
+ def receive[A](f: Any =>? A): A =
self.receive(f)
/**
@@ -175,7 +175,7 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return the result of processing the received message
*/
- def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R =
+ def receiveWithin[R](msec: Long)(f: Any =>? R): R =
self.receiveWithin(msec)(f)
/**
@@ -188,7 +188,7 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return this function never returns
*/
- def react(f: PartialFunction[Any, Unit]): Nothing =
+ def react(f: Any =>? Unit): Nothing =
rawSelf.react(f)
/**
@@ -202,14 +202,14 @@ object Actor {
* @param f a partial function specifying patterns and actions
* @return this function never returns
*/
- def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing =
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing =
self.reactWithin(msec)(f)
- def eventloop(f: PartialFunction[Any, Unit]): Nothing =
+ def eventloop(f: Any =>? Unit): Nothing =
rawSelf.react(new RecursiveProxyHandler(rawSelf, f))
- private class RecursiveProxyHandler(a: Reactor, f: PartialFunction[Any, Unit])
- extends PartialFunction[Any, Unit] {
+ private class RecursiveProxyHandler(a: Reactor, f: Any =>? Unit)
+ extends (Any =>? Unit) {
def isDefinedAt(m: Any): Boolean =
true // events are immediately removed from the mailbox
def apply(m: Any) {
@@ -261,9 +261,9 @@ object Actor {
* }
* </pre>
*/
- def respondOn[A, B](fun: PartialFunction[A, Unit] => Nothing):
- PartialFunction[A, B] => Responder[B] =
- (caseBlock: PartialFunction[A, B]) => new Responder[B] {
+ def respondOn[A, B](fun: A =>? Unit => Nothing):
+ A =>? B => Responder[B] =
+ (caseBlock: A =>? B) => new Responder[B] {
def respond(k: B => Unit) = fun(caseBlock andThen k)
}
@@ -428,7 +428,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: PartialFunction[Any, R]): R = {
+ def receive[R](f: Any =>? R): R = {
assert(Actor.self(scheduler) == this, "receive from channel belonging to other actor")
synchronized {
@@ -479,7 +479,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = {
+ def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
assert(Actor.self(scheduler) == this, "receive from channel belonging to other actor")
synchronized {
@@ -559,7 +559,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
*
* @param f a partial function with message patterns and actions
*/
- override def react(f: PartialFunction[Any, Unit]): Nothing = {
+ override def react(f: Any =>? Unit): Nothing = {
assert(Actor.self(scheduler) == this, "react on channel belonging to other actor")
synchronized {
if (shouldExit) exit() // links
@@ -580,7 +580,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = {
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
assert(Actor.self(scheduler) == this, "react on channel belonging to other actor")
synchronized {
@@ -646,7 +646,7 @@ trait Actor extends AbstractActor with ReplyReactor with ReplyableActor {
}
// guarded by lock of this
- private[actors] override def scheduleActor(f: PartialFunction[Any, Unit], msg: Any) =
+ private[actors] override def scheduleActor(f: Any =>? Unit, msg: Any) =
if ((f eq null) && (continuation eq null)) {
// do nothing (timeout is handled instead)
}
diff --git a/src/actors/scala/actors/Channel.scala b/src/actors/scala/actors/Channel.scala
index 24340d22f2..1454f29214 100644
--- a/src/actors/scala/actors/Channel.scala
+++ b/src/actors/scala/actors/Channel.scala
@@ -76,7 +76,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: PartialFunction[Msg, R]): R = {
+ def receive[R](f: Msg =>? R): R = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receive {
@@ -99,7 +99,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = {
+ def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receiveWithin(msec) {
@@ -116,7 +116,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
*
* @param f a partial function with message patterns and actions
*/
- def react(f: PartialFunction[Msg, Unit]): Nothing = {
+ def react(f: Msg =>? Unit): Nothing = {
val C = this.asInstanceOf[Channel[Any]]
receiver.react {
case C ! msg if (f.isDefinedAt(msg.asInstanceOf[Msg])) => f(msg.asInstanceOf[Msg])
@@ -133,7 +133,7 @@ class Channel[Msg](val receiver: Actor) extends InputChannel[Msg] with OutputCha
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = {
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
val C = this.asInstanceOf[Channel[Any]]
val recvActor = receiver.asInstanceOf[Actor]
recvActor.reactWithin(msec) {
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala
index ebb0489d88..1369ed6255 100644
--- a/src/actors/scala/actors/Future.scala
+++ b/src/actors/scala/actors/Future.scala
@@ -153,7 +153,7 @@ object Futures {
val partFuns = unsetFts.map((p: Pair[Int, Future[Any]]) => {
val FutCh = p._2.inputChannel
- val singleCase: PartialFunction[Any, Pair[Int, Any]] = {
+ val singleCase: Any =>? Pair[Int, Any] = {
case FutCh ! any => Pair(p._1, any)
}
singleCase
@@ -165,8 +165,8 @@ object Futures {
}
Actor.timer.schedule(timerTask, timeout)
- def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) {
- val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] {
+ def awaitWith(partFuns: Seq[Any =>? Pair[Int, Any]]) {
+ val reaction: Any =>? Unit = new (Any =>? Unit) {
def isDefinedAt(msg: Any) = msg match {
case TIMEOUT => true
case _ => partFuns exists (_ isDefinedAt msg)
diff --git a/src/actors/scala/actors/InputChannel.scala b/src/actors/scala/actors/InputChannel.scala
index 46988159fa..fb922f27b2 100644
--- a/src/actors/scala/actors/InputChannel.scala
+++ b/src/actors/scala/actors/InputChannel.scala
@@ -25,7 +25,7 @@ trait InputChannel[+Msg] {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: PartialFunction[Msg, R]): R
+ def receive[R](f: Msg =>? R): R
/**
* Receives a message from this <code>InputChannel</code> within
@@ -35,7 +35,7 @@ trait InputChannel[+Msg] {
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R
+ def receiveWithin[R](msec: Long)(f: Any =>? R): R
/**
* Receives a message from this <code>InputChannel</code>.
@@ -45,7 +45,7 @@ trait InputChannel[+Msg] {
*
* @param f a partial function with message patterns and actions
*/
- def react(f: PartialFunction[Msg, Unit]): Nothing
+ def react(f: Msg =>? Unit): Nothing
/**
* Receives a message from this <code>InputChannel</code> within
@@ -57,7 +57,7 @@ trait InputChannel[+Msg] {
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing
/**
* Receives the next message from this <code>Channel</code>.
diff --git a/src/actors/scala/actors/ReactChannel.scala b/src/actors/scala/actors/ReactChannel.scala
index 8bbbc04f53..926805fbe7 100644
--- a/src/actors/scala/actors/ReactChannel.scala
+++ b/src/actors/scala/actors/ReactChannel.scala
@@ -55,7 +55,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
*
* @param f a partial function with message patterns and actions
*/
- def react(f: PartialFunction[Msg, Unit]): Nothing = {
+ def react(f: Msg =>? Unit): Nothing = {
val C = this
receiver.react {
case SendToReactor(C, msg) if (f.isDefinedAt(msg.asInstanceOf[Msg])) =>
@@ -73,7 +73,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
* @param msec the time span before timeout
* @param f a partial function with message patterns and actions
*/
- def reactWithin(msec: Long)(f: PartialFunction[Any, Unit]): Nothing = {
+ def reactWithin(msec: Long)(f: Any =>? Unit): Nothing = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.reactWithin(msec) {
@@ -89,7 +89,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receive[R](f: PartialFunction[Msg, R]): R = {
+ def receive[R](f: Msg =>? R): R = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receive {
@@ -106,7 +106,7 @@ private[actors] class ReactChannel[Msg](receiver: Reactor) extends InputChannel[
* @param f a partial function with message patterns and actions
* @return result of processing the received value
*/
- def receiveWithin[R](msec: Long)(f: PartialFunction[Any, R]): R = {
+ def receiveWithin[R](msec: Long)(f: Any =>? R): R = {
val C = this
val recvActor = receiver.asInstanceOf[Actor]
recvActor.receiveWithin(msec) {
diff --git a/src/actors/scala/actors/Reaction.scala b/src/actors/scala/actors/Reaction.scala
index 25aea803af..a4736f9489 100644
--- a/src/actors/scala/actors/Reaction.scala
+++ b/src/actors/scala/actors/Reaction.scala
@@ -26,7 +26,7 @@ private[actors] class KillActorException extends Throwable with ControlException
* @deprecated("this class is going to be removed in a future release")
* @author Philipp Haller
*/
-class Reaction(a: Actor, f: PartialFunction[Any, Unit], msg: Any) extends ActorTask(a, () => {
+class Reaction(a: Actor, f: Any =>? Unit, msg: Any) extends ActorTask(a, () => {
if (f == null)
a.act()
else
diff --git a/src/actors/scala/actors/Reactor.scala b/src/actors/scala/actors/Reactor.scala
index 0eff67c163..d641f54eb6 100644
--- a/src/actors/scala/actors/Reactor.scala
+++ b/src/actors/scala/actors/Reactor.scala
@@ -41,7 +41,7 @@ trait Reactor extends OutputChannel[Any] {
* message handler that react was called with.
*/
@volatile
- private[actors] var continuation: PartialFunction[Any, Unit] = null
+ private[actors] var continuation: Any =>? Unit = null
/* Whenever this Actor executes on some thread, waitingFor is
* guaranteed to be equal to waitingForNone.
@@ -61,7 +61,7 @@ trait Reactor extends OutputChannel[Any] {
*/
def act(): Unit
- protected[actors] def exceptionHandler: PartialFunction[Exception, Unit] =
+ protected[actors] def exceptionHandler: Exception =>? Unit =
Map()
protected[actors] def scheduler: IScheduler =
@@ -159,7 +159,7 @@ trait Reactor extends OutputChannel[Any] {
}
}
- protected[actors] def react(f: PartialFunction[Any, Unit]): Nothing = {
+ protected[actors] def react(f: Any =>? Unit): Nothing = {
assert(Actor.rawSelf(scheduler) == this, "react on channel belonging to other actor")
synchronized { drainSendBuffer(mailbox) }
continuation = f
@@ -172,7 +172,7 @@ trait Reactor extends OutputChannel[Any] {
*
* assume handler != null
*/
- private[actors] def scheduleActor(handler: PartialFunction[Any, Unit], msg: Any) = {
+ private[actors] def scheduleActor(handler: Any =>? Unit, msg: Any) = {
val fun = () => handler(msg)
val task = new ReactorTask(this, fun)
scheduler executeFromActor task
diff --git a/src/actors/scala/actors/Replyable.scala b/src/actors/scala/actors/Replyable.scala
index 2c7e55e06a..b1ccb3205e 100644
--- a/src/actors/scala/actors/Replyable.scala
+++ b/src/actors/scala/actors/Replyable.scala
@@ -59,7 +59,7 @@ trait Replyable[-T, +R] {
* @param f the function to be applied to the response
* @return the future
*/
- def !![P](msg: T, f: PartialFunction[R, P]): () => P =
+ def !![P](msg: T, f: R =>? P): () => P =
() => f(this !? msg)
}
diff --git a/src/actors/scala/actors/ReplyableActor.scala b/src/actors/scala/actors/ReplyableActor.scala
index 2122dd854b..b562dbf855 100644
--- a/src/actors/scala/actors/ReplyableActor.scala
+++ b/src/actors/scala/actors/ReplyableActor.scala
@@ -62,7 +62,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
* <code>f</code>. This also allows to recover a more
* precise type for the reply value.
*/
- override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = {
+ override def !![A](msg: Any, f: Any =>? A): Future[A] = {
val ftch = new Channel[A](Actor.self(thiz.scheduler))
thiz.send(msg, new OutputChannel[Any] {
def !(msg: Any) =
@@ -108,7 +108,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
Futures.fromInputChannel(someChan)
}
// should never be invoked; return dummy value
- override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = {
+ override def !![A](msg: Any, f: Any =>? A): Future[A] = {
val someChan = new Channel[A](Actor.self(thiz.scheduler))
Futures.fromInputChannel(someChan)
}
@@ -117,7 +117,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
thiz.send(msg, linkedChannel)
new Future[Any](ftch) {
var exitReason: Option[Any] = None
- val handleReply: PartialFunction[Any, Unit] = {
+ val handleReply: Any =>? Unit = {
case Exit(from, reason) =>
exitReason = Some(reason)
case any =>
@@ -145,7 +145,7 @@ private[actors] trait ReplyableActor extends ReplyableReactor {
def isSet = (fvalue match {
case None =>
- val handleTimeout: PartialFunction[Any, Boolean] = {
+ val handleTimeout: Any =>? Boolean = {
case TIMEOUT =>
false
}
diff --git a/src/actors/scala/actors/ReplyableReactor.scala b/src/actors/scala/actors/ReplyableReactor.scala
index ecca50e26d..f5a2752f54 100644
--- a/src/actors/scala/actors/ReplyableReactor.scala
+++ b/src/actors/scala/actors/ReplyableReactor.scala
@@ -70,7 +70,7 @@ private[actors] trait ReplyableReactor extends Replyable[Any, Any] {
* <code>f</code>. This also allows to recover a more
* precise type for the reply value.
*/
- override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] = {
+ override def !![A](msg: Any, f: Any =>? A): Future[A] = {
val myself = Actor.rawSelf(this.scheduler)
val ftch = new ReactChannel[A](myself)
val res = new scala.concurrent.SyncVar[A]
diff --git a/src/actors/scala/actors/remote/Proxy.scala b/src/actors/scala/actors/remote/Proxy.scala
index f9a6cd8fed..c1744a2dfc 100644
--- a/src/actors/scala/actors/remote/Proxy.scala
+++ b/src/actors/scala/actors/remote/Proxy.scala
@@ -69,7 +69,7 @@ private[remote] class Proxy(node: Node, name: Symbol, @transient var kernel: Net
override def !!(msg: Any): Future[Any] =
del !! msg
- override def !![A](msg: Any, f: PartialFunction[Any, A]): Future[A] =
+ override def !![A](msg: Any, f: Any =>? A): Future[A] =
del !! (msg, f)
def linkTo(to: AbstractActor): Unit =