summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/parallel/ParIterableView.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-09-23 13:46:26 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-09-23 13:46:26 +0000
commita3aa8993d2ed9314206c1fbd2d5b56879f91bb0f (patch)
tree6ba553f9842c45a40a9131a051ef9dd48739b510 /src/library/scala/collection/parallel/ParIterableView.scala
parentd7420203456f4369a490310170a2597cb4c32fe6 (diff)
downloadscala-a3aa8993d2ed9314206c1fbd2d5b56879f91bb0f.tar.gz
scala-a3aa8993d2ed9314206c1fbd2d5b56879f91bb0f.tar.bz2
scala-a3aa8993d2ed9314206c1fbd2d5b56879f91bb0f.zip
Adds a zip for ParIterables + a new Zipped view...
Adds a zip for ParIterables + a new Zipped view for ParSeqView and ParIterableView + a bench test. No review
Diffstat (limited to 'src/library/scala/collection/parallel/ParIterableView.scala')
-rw-r--r--src/library/scala/collection/parallel/ParIterableView.scala23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/library/scala/collection/parallel/ParIterableView.scala b/src/library/scala/collection/parallel/ParIterableView.scala
index dd703b5c8b..5efe87c9ee 100644
--- a/src/library/scala/collection/parallel/ParIterableView.scala
+++ b/src/library/scala/collection/parallel/ParIterableView.scala
@@ -6,6 +6,7 @@ package scala.collection.parallel
import scala.collection.Parallel
import scala.collection.TraversableViewLike
import scala.collection.IterableView
+import scala.collection.generic.CanCombineFrom
@@ -23,6 +24,28 @@ extends ParIterableViewLike[T, Coll, CollSeq, ParIterableView[T, Coll, CollSeq],
+object ParIterableView {
+ abstract class NoCombiner[T] extends Combiner[T, Nothing] {
+ self: EnvironmentPassingCombiner[T, Nothing] =>
+ def +=(elem: T): this.type = this
+ def iterator: Iterator[T] = Iterator.empty
+ def result() = throw new UnsupportedOperationException("ParIterableView.Combiner.result")
+ def size = throw new UnsupportedOperationException("ParIterableView.Combiner.size")
+ def clear() {}
+ def combine[N <: T, NewTo >: Nothing](other: Combiner[N, NewTo]) =
+ throw new UnsupportedOperationException("ParIterableView.Combiner.result")
+ }
+
+ type Coll = ParIterableView[_, C, _] forSome { type C <: ParIterable[_] }
+
+ implicit def canBuildFrom[T]: CanCombineFrom[Coll, T, ParIterableView[T, ParIterable[T], Iterable[T]]] =
+ new CanCombineFrom[Coll, T, ParIterableView[T, ParIterable[T], Iterable[T]]] {
+ def apply(from: Coll) = new NoCombiner[T] with EnvironmentPassingCombiner[T, Nothing]
+ def apply() = new NoCombiner[T] with EnvironmentPassingCombiner[T, Nothing]
+ }
+}
+
+