diff options
author | Den Shabalin <den.shabalin@gmail.com> | 2013-11-13 15:33:33 +0100 |
---|---|---|
committer | Den Shabalin <den.shabalin@gmail.com> | 2013-11-20 16:06:30 +0100 |
commit | b004c3ddb38f8e690a0895a51ad0c83ff57a01e7 (patch) | |
tree | 0c31f83d2e039db4c2ead7a3280aaabc78671333 /src/actors | |
parent | c243435f113615b2f7407fbd683c93ec16c73749 (diff) | |
download | scala-b004c3ddb38f8e690a0895a51ad0c83ff57a01e7.tar.gz scala-b004c3ddb38f8e690a0895a51ad0c83ff57a01e7.tar.bz2 scala-b004c3ddb38f8e690a0895a51ad0c83ff57a01e7.zip |
deprecate Pair and Triple
Diffstat (limited to 'src/actors')
-rw-r--r-- | src/actors/scala/actors/Future.scala | 14 | ||||
-rw-r--r-- | src/actors/scala/actors/remote/NetKernel.scala | 8 | ||||
-rw-r--r-- | src/actors/scala/actors/remote/Proxy.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/remote/RemoteActor.scala | 4 | ||||
-rw-r--r-- | src/actors/scala/actors/remote/TcpService.scala | 8 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala index 9d123cb2d5..4421c7a07a 100644 --- a/src/actors/scala/actors/Future.scala +++ b/src/actors/scala/actors/Future.scala @@ -180,17 +180,17 @@ object Futures { var cnt = 0 val mappedFts = fts.map(ft => - Pair({cnt+=1; cnt-1}, ft)) + ({cnt+=1; cnt-1}, ft)) - val unsetFts = mappedFts.filter((p: Pair[Int, Future[Any]]) => { + val unsetFts = mappedFts.filter((p: Tuple2[Int, Future[Any]]) => { if (p._2.isSet) { resultsMap(p._1) = Some(p._2()); false } else { resultsMap(p._1) = None; true } }) - val partFuns = unsetFts.map((p: Pair[Int, Future[Any]]) => { + val partFuns = unsetFts.map((p: Tuple2[Int, Future[Any]]) => { val FutCh = p._2.inputChannel - val singleCase: PartialFunction[Any, Pair[Int, Any]] = { - case FutCh ! any => Pair(p._1, any) + val singleCase: PartialFunction[Any, Tuple2[Int, Any]] = { + case FutCh ! any => (p._1, any) } singleCase }) @@ -201,7 +201,7 @@ object Futures { } Actor.timer.schedule(timerTask, timeout) - def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) { + def awaitWith(partFuns: Seq[PartialFunction[Any, Tuple2[Int, Any]]]) { val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] { def isDefinedAt(msg: Any) = msg match { case TIMEOUT => true @@ -212,7 +212,7 @@ object Futures { case _ => { val pfOpt = partFuns find (_ isDefinedAt msg) val pf = pfOpt.get // succeeds always - val Pair(idx, subres) = pf(msg) + val (idx, subres) = pf(msg) resultsMap(idx) = Some(subres) val partFunsRest = partFuns filter (_ != pf) diff --git a/src/actors/scala/actors/remote/NetKernel.scala b/src/actors/scala/actors/remote/NetKernel.scala index 4795ff3eb6..57d7af6d26 100644 --- a/src/actors/scala/actors/remote/NetKernel.scala +++ b/src/actors/scala/actors/remote/NetKernel.scala @@ -43,8 +43,8 @@ private[remote] class NetKernel(service: Service) { private val names = new mutable.HashMap[OutputChannel[Any], Symbol] def register(name: Symbol, a: OutputChannel[Any]): Unit = synchronized { - actors += Pair(name, a) - names += Pair(a, name) + actors(name) = a + names(a) = name } def getOrCreateName(from: OutputChannel[Any]) = names.get(from) match { @@ -79,7 +79,7 @@ private[remote] class NetKernel(service: Service) { def createProxy(node: Node, sym: Symbol): Proxy = { val p = new Proxy(node, sym, this) - proxies += Pair((node, sym), p) + proxies((node, sym)) = p p } @@ -99,7 +99,7 @@ private[remote] class NetKernel(service: Service) { proxies.synchronized { proxies.get((senderNode, senderName)) match { case Some(senderProxy) => // do nothing - case None => proxies += Pair((senderNode, senderName), p) + case None => proxies((senderNode, senderName)) = p } } diff --git a/src/actors/scala/actors/remote/Proxy.scala b/src/actors/scala/actors/remote/Proxy.scala index 43a43ac99c..9949b36181 100644 --- a/src/actors/scala/actors/remote/Proxy.scala +++ b/src/actors/scala/actors/remote/Proxy.scala @@ -142,7 +142,7 @@ private[remote] class DelegateActor(creator: Proxy, node: Node, name: Symbol, ke // create a new reply channel... val replyCh = new Channel[Any](this) // ...that maps to session - sessionMap += Pair(replyCh, session) + sessionMap(replyCh) = session // local send out.send(msg, replyCh) @@ -178,7 +178,7 @@ private[remote] class DelegateActor(creator: Proxy, node: Node, name: Symbol, ke // create fresh session ID... val fresh = FreshNameCreator.newName(node+"@"+name) // ...that maps to reply channel - channelMap += Pair(fresh, sender) + channelMap(fresh) = sender kernel.forward(sender, node, name, msg, fresh) } else { kernel.forward(sender, node, name, msg, 'nosession) diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala index 799076a01f..2daf9ceb43 100644 --- a/src/actors/scala/actors/remote/RemoteActor.scala +++ b/src/actors/scala/actors/remote/RemoteActor.scala @@ -64,7 +64,7 @@ object RemoteActor { val serv = TcpService(port, cl) val kern = serv.kernel val s = Actor.self(Scheduler) - kernels += Pair(s, kern) + kernels(s) = kern s.onTerminate { Debug.info("alive actor "+s+" terminated") @@ -90,7 +90,7 @@ object RemoteActor { val kernel = kernels.get(Actor.self(Scheduler)) match { case None => val serv = TcpService(TcpService.generatePort, cl) - kernels += Pair(Actor.self(Scheduler), serv.kernel) + kernels(Actor.self(Scheduler)) = serv.kernel serv.kernel case Some(k) => k diff --git a/src/actors/scala/actors/remote/TcpService.scala b/src/actors/scala/actors/remote/TcpService.scala index 75e36b2738..69e5c46c52 100644 --- a/src/actors/scala/actors/remote/TcpService.scala +++ b/src/actors/scala/actors/remote/TcpService.scala @@ -35,7 +35,7 @@ object TcpService { service case None => val service = new TcpService(port, cl) - ports += Pair(port, service) + ports(port) = service service.start() Debug.info("created service at "+service.node) service @@ -106,9 +106,9 @@ class TcpService(port: Int, cl: ClassLoader) extends Thread with Service { // when remote net kernel comes up (pendingSends.get(node): @unchecked) match { case None => - pendingSends += Pair(node, List(data)) + pendingSends(node) = List(data) case Some(msgs) if msgs.length < TcpService.BufSize => - pendingSends += Pair(node, data :: msgs) + pendingSends(node) = data :: msgs } } @@ -183,7 +183,7 @@ class TcpService(port: Int, cl: ClassLoader) extends Thread with Service { new mutable.HashMap[Node, TcpServiceWorker] private[actors] def addConnection(node: Node, worker: TcpServiceWorker) = synchronized { - connections += Pair(node, worker) + connections(node) = worker } def getConnection(n: Node) = synchronized { |