summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/collection/TraversableViewLike.scala1
-rw-r--r--src/library/scala/collection/parallel/ParIterableLike.scala124
-rw-r--r--src/library/scala/collection/parallel/ParSeqLike.scala44
-rw-r--r--src/library/scala/collection/parallel/ParSeqViewLike.scala4
-rw-r--r--src/library/scala/collection/parallel/RemainsIterator.scala121
-rw-r--r--src/library/scala/collection/parallel/mutable/ParArray.scala26
-rw-r--r--test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_view/SeqViewBenches.scala2
7 files changed, 132 insertions, 190 deletions
diff --git a/src/library/scala/collection/TraversableViewLike.scala b/src/library/scala/collection/TraversableViewLike.scala
index 9ff230938e..7c078ae5d6 100644
--- a/src/library/scala/collection/TraversableViewLike.scala
+++ b/src/library/scala/collection/TraversableViewLike.scala
@@ -14,6 +14,7 @@ import generic._
import mutable.{Builder, ArrayBuffer}
import TraversableView.NoBuilder
+
/** A template trait for non-strict views of traversable collections.
* $traversableviewinfo
*
diff --git a/src/library/scala/collection/parallel/ParIterableLike.scala b/src/library/scala/collection/parallel/ParIterableLike.scala
index 1cc27fb186..8fc232579a 100644
--- a/src/library/scala/collection/parallel/ParIterableLike.scala
+++ b/src/library/scala/collection/parallel/ParIterableLike.scala
@@ -124,7 +124,7 @@ extends IterableLike[T, Repr]
with Parallel
with HasNewCombiner[T, Repr]
with TaskSupport {
- self =>
+self =>
/** Parallel iterators are split iterators that have additional accessor and
* transformer methods defined in terms of methods `next` and `hasNext`.
@@ -137,7 +137,7 @@ extends IterableLike[T, Repr]
* The self-type ensures that signal context passing behaviour gets mixed in
* a concrete object instance.
*/
- trait ParIterator extends ParIterableIterator[T, Repr] {
+ trait ParIterator extends ParIterableIterator[T] {
me: SignalContextPassingIterator[ParIterator] =>
var signalDelegate: Signalling = IdleSignalling
def repr = self.repr
@@ -631,8 +631,8 @@ extends IterableLike[T, Repr]
*/
protected trait Accessor[R, Tp]
extends super.Task[R, Tp] {
- val pit: ParIterator
- def newSubtask(p: ParIterator): Accessor[R, Tp]
+ protected[this] val pit: ParIterableIterator[T]
+ protected[this] def newSubtask(p: ParIterableIterator[T]): Accessor[R, Tp]
def shouldSplitFurther = pit.remaining > threshold(size, parallelismLevel)
def split = pit.split.map(newSubtask(_)) // default split procedure
override def toString = "Accessor(" + pit.toString + ")"
@@ -687,152 +687,152 @@ extends IterableLike[T, Repr]
protected trait Transformer[R, Tp] extends Accessor[R, Tp]
- protected[this] class Foreach[S](op: T => S, val pit: ParIterator) extends Accessor[Unit, Foreach[S]] {
+ protected[this] class Foreach[S](op: T => S, protected[this] val pit: ParIterableIterator[T]) extends Accessor[Unit, Foreach[S]] {
var result: Unit = ()
def leaf(prevr: Option[Unit]) = pit.foreach(op)
- def newSubtask(p: ParIterator) = new Foreach[S](op, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Foreach[S](op, p)
}
- protected[this] class Count(pred: T => Boolean, val pit: ParIterator) extends Accessor[Int, Count] {
+ protected[this] class Count(pred: T => Boolean, protected[this] val pit: ParIterableIterator[T]) extends Accessor[Int, Count] {
var result: Int = 0
def leaf(prevr: Option[Int]) = result = pit.count(pred)
- def newSubtask(p: ParIterator) = new Count(pred, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Count(pred, p)
override def merge(that: Count) = result = result + that.result
}
- protected[this] class Reduce[U >: T](op: (U, U) => U, val pit: ParIterator) extends Accessor[U, Reduce[U]] {
+ protected[this] class Reduce[U >: T](op: (U, U) => U, protected[this] val pit: ParIterableIterator[T]) extends Accessor[U, Reduce[U]] {
var result: U = null.asInstanceOf[U]
def leaf(prevr: Option[U]) = result = pit.reduce(op)
- def newSubtask(p: ParIterator) = new Reduce(op, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Reduce(op, p)
override def merge(that: Reduce[U]) = result = op(result, that.result)
}
- protected[this] class Fold[U >: T](z: U, op: (U, U) => U, val pit: ParIterator) extends Accessor[U, Fold[U]] {
+ protected[this] class Fold[U >: T](z: U, op: (U, U) => U, protected[this] val pit: ParIterableIterator[T]) extends Accessor[U, Fold[U]] {
var result: U = null.asInstanceOf[U]
def leaf(prevr: Option[U]) = result = pit.fold(z)(op)
- def newSubtask(p: ParIterator) = new Fold(z, op, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Fold(z, op, p)
override def merge(that: Fold[U]) = result = op(result, that.result)
}
- protected[this] class Aggregate[S](z: S, seqop: (S, T) => S, combop: (S, S) => S, val pit: ParIterator)
+ protected[this] class Aggregate[S](z: S, seqop: (S, T) => S, combop: (S, S) => S, protected[this] val pit: ParIterableIterator[T])
extends Accessor[S, Aggregate[S]] {
var result: S = null.asInstanceOf[S]
def leaf(prevr: Option[S]) = result = pit.foldLeft(z)(seqop)
- def newSubtask(p: ParIterator) = new Aggregate(z, seqop, combop, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Aggregate(z, seqop, combop, p)
override def merge(that: Aggregate[S]) = result = combop(result, that.result)
}
- protected[this] class Sum[U >: T](num: Numeric[U], val pit: ParIterator) extends Accessor[U, Sum[U]] {
+ protected[this] class Sum[U >: T](num: Numeric[U], protected[this] val pit: ParIterableIterator[T]) extends Accessor[U, Sum[U]] {
var result: U = null.asInstanceOf[U]
def leaf(prevr: Option[U]) = result = pit.sum(num)
- def newSubtask(p: ParIterator) = new Sum(num, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Sum(num, p)
override def merge(that: Sum[U]) = result = num.plus(result, that.result)
}
- protected[this] class Product[U >: T](num: Numeric[U], val pit: ParIterator) extends Accessor[U, Product[U]] {
+ protected[this] class Product[U >: T](num: Numeric[U], protected[this] val pit: ParIterableIterator[T]) extends Accessor[U, Product[U]] {
var result: U = null.asInstanceOf[U]
def leaf(prevr: Option[U]) = result = pit.product(num)
- def newSubtask(p: ParIterator) = new Product(num, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Product(num, p)
override def merge(that: Product[U]) = result = num.times(result, that.result)
}
- protected[this] class Min[U >: T](ord: Ordering[U], val pit: ParIterator) extends Accessor[U, Min[U]] {
+ protected[this] class Min[U >: T](ord: Ordering[U], protected[this] val pit: ParIterableIterator[T]) extends Accessor[U, Min[U]] {
var result: U = null.asInstanceOf[U]
def leaf(prevr: Option[U]) = result = pit.min(ord)
- def newSubtask(p: ParIterator) = new Min(ord, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Min(ord, p)
override def merge(that: Min[U]) = result = if (ord.lteq(result, that.result)) result else that.result
}
- protected[this] class Max[U >: T](ord: Ordering[U], val pit: ParIterator) extends Accessor[U, Max[U]] {
+ protected[this] class Max[U >: T](ord: Ordering[U], protected[this] val pit: ParIterableIterator[T]) extends Accessor[U, Max[U]] {
var result: U = null.asInstanceOf[U]
def leaf(prevr: Option[U]) = result = pit.max(ord)
- def newSubtask(p: ParIterator) = new Max(ord, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Max(ord, p)
override def merge(that: Max[U]) = result = if (ord.gteq(result, that.result)) result else that.result
}
- protected[this] class Map[S, That](f: T => S, pbf: CanCombineFrom[Repr, S, That], val pit: ParIterator)
+ protected[this] class Map[S, That](f: T => S, pbf: CanCombineFrom[Repr, S, That], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[S, That], Map[S, That]] {
var result: Combiner[S, That] = null
def leaf(prev: Option[Combiner[S, That]]) = result = pit.map2combiner(f, reuse(prev, pbf(self.repr)))
- def newSubtask(p: ParIterator) = new Map(f, pbf, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Map(f, pbf, p)
override def merge(that: Map[S, That]) = result = result combine that.result
}
protected[this] class Collect[S, That]
- (pf: PartialFunction[T, S], pbf: CanCombineFrom[Repr, S, That], val pit: ParIterator)
+ (pf: PartialFunction[T, S], pbf: CanCombineFrom[Repr, S, That], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[S, That], Collect[S, That]] {
var result: Combiner[S, That] = null
- def leaf(prev: Option[Combiner[S, That]]) = result = pit.collect2combiner[S, That](pf, pbf) // TODO
- def newSubtask(p: ParIterator) = new Collect(pf, pbf, p)
+ def leaf(prev: Option[Combiner[S, That]]) = result = pit.collect2combiner[S, That](pf, pbf(self.repr))
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Collect(pf, pbf, p)
override def merge(that: Collect[S, That]) = result = result combine that.result
}
- protected[this] class FlatMap[S, That](f: T => Traversable[S], pbf: CanCombineFrom[Repr, S, That], val pit: ParIterator)
+ protected[this] class FlatMap[S, That](f: T => Traversable[S], pbf: CanCombineFrom[Repr, S, That], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[S, That], FlatMap[S, That]] {
var result: Combiner[S, That] = null
- def leaf(prev: Option[Combiner[S, That]]) = result = pit.flatmap2combiner(f, pbf) // TODO
- def newSubtask(p: ParIterator) = new FlatMap(f, pbf, p)
+ def leaf(prev: Option[Combiner[S, That]]) = result = pit.flatmap2combiner(f, pbf(self.repr))
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new FlatMap(f, pbf, p)
override def merge(that: FlatMap[S, That]) = result = result combine that.result
}
- protected[this] class Forall(pred: T => Boolean, val pit: ParIterator) extends Accessor[Boolean, Forall] {
+ protected[this] class Forall(pred: T => Boolean, protected[this] val pit: ParIterableIterator[T]) extends Accessor[Boolean, Forall] {
var result: Boolean = true
def leaf(prev: Option[Boolean]) = { if (!pit.isAborted) result = pit.forall(pred); if (result == false) pit.abort }
- def newSubtask(p: ParIterator) = new Forall(pred, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Forall(pred, p)
override def merge(that: Forall) = result = result && that.result
}
- protected[this] class Exists(pred: T => Boolean, val pit: ParIterator) extends Accessor[Boolean, Exists] {
+ protected[this] class Exists(pred: T => Boolean, protected[this] val pit: ParIterableIterator[T]) extends Accessor[Boolean, Exists] {
var result: Boolean = false
def leaf(prev: Option[Boolean]) = { if (!pit.isAborted) result = pit.exists(pred); if (result == true) pit.abort }
- def newSubtask(p: ParIterator) = new Exists(pred, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Exists(pred, p)
override def merge(that: Exists) = result = result || that.result
}
- protected[this] class Find[U >: T](pred: T => Boolean, val pit: ParIterator) extends Accessor[Option[U], Find[U]] {
+ protected[this] class Find[U >: T](pred: T => Boolean, protected[this] val pit: ParIterableIterator[T]) extends Accessor[Option[U], Find[U]] {
var result: Option[U] = None
def leaf(prev: Option[Option[U]]) = { if (!pit.isAborted) result = pit.find(pred); if (result != None) pit.abort }
- def newSubtask(p: ParIterator) = new Find(pred, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Find(pred, p)
override def merge(that: Find[U]) = if (this.result == None) result = that.result
}
- protected[this] class Filter[U >: T, This >: Repr](pred: T => Boolean, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class Filter[U >: T, This >: Repr](pred: T => Boolean, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[U, This], Filter[U, This]] {
var result: Combiner[U, This] = null
def leaf(prev: Option[Combiner[U, This]]) = result = pit.filter2combiner(pred, reuse(prev, cbf()))
- def newSubtask(p: ParIterator) = new Filter(pred, cbf, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Filter(pred, cbf, p)
override def merge(that: Filter[U, This]) = result = result combine that.result
}
- protected[this] class FilterNot[U >: T, This >: Repr](pred: T => Boolean, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class FilterNot[U >: T, This >: Repr](pred: T => Boolean, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[U, This], FilterNot[U, This]] {
var result: Combiner[U, This] = null
def leaf(prev: Option[Combiner[U, This]]) = result = pit.filterNot2combiner(pred, reuse(prev, cbf()))
- def newSubtask(p: ParIterator) = new FilterNot(pred, cbf, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new FilterNot(pred, cbf, p)
override def merge(that: FilterNot[U, This]) = result = result combine that.result
}
- protected class Copy[U >: T, That](cfactory: () => Combiner[U, That], val pit: ParIterator)
+ protected class Copy[U >: T, That](cfactory: () => Combiner[U, That], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[U, That], Copy[U, That]] {
var result: Combiner[U, That] = null
def leaf(prev: Option[Combiner[U, That]]) = result = pit.copy2builder[U, That, Combiner[U, That]](reuse(prev, cfactory()))
- def newSubtask(p: ParIterator) = new Copy[U, That](cfactory, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Copy[U, That](cfactory, p)
override def merge(that: Copy[U, That]) = result = result combine that.result
}
- protected[this] class Partition[U >: T, This >: Repr](pred: T => Boolean, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class Partition[U >: T, This >: Repr](pred: T => Boolean, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[(Combiner[U, This], Combiner[U, This]), Partition[U, This]] {
var result: (Combiner[U, This], Combiner[U, This]) = null
def leaf(prev: Option[(Combiner[U, This], Combiner[U, This])]) = result = pit.partition2combiners(pred, reuse(prev.map(_._1), cbf()), reuse(prev.map(_._2), cbf()))
- def newSubtask(p: ParIterator) = new Partition(pred, cbf, p)
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = new Partition(pred, cbf, p)
override def merge(that: Partition[U, This]) = result = (result._1 combine that.result._1, result._2 combine that.result._2)
}
- protected[this] class Take[U >: T, This >: Repr](n: Int, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class Take[U >: T, This >: Repr](n: Int, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[U, This], Take[U, This]] {
var result: Combiner[U, This] = null
def leaf(prev: Option[Combiner[U, This]]) = result = pit.take2combiner(n, reuse(prev, cbf()))
- def newSubtask(p: ParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
val sizes = pits.scanLeft(0)(_ + _.remaining)
@@ -844,11 +844,11 @@ extends IterableLike[T, Repr]
override def merge(that: Take[U, This]) = result = result combine that.result
}
- protected[this] class Drop[U >: T, This >: Repr](n: Int, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class Drop[U >: T, This >: Repr](n: Int, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[U, This], Drop[U, This]] {
var result: Combiner[U, This] = null
def leaf(prev: Option[Combiner[U, This]]) = result = pit.drop2combiner(n, reuse(prev, cbf()))
- def newSubtask(p: ParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
val sizes = pits.scanLeft(0)(_ + _.remaining)
@@ -860,11 +860,11 @@ extends IterableLike[T, Repr]
override def merge(that: Drop[U, This]) = result = result combine that.result
}
- protected[this] class Slice[U >: T, This >: Repr](from: Int, until: Int, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class Slice[U >: T, This >: Repr](from: Int, until: Int, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[Combiner[U, This], Slice[U, This]] {
var result: Combiner[U, This] = null
def leaf(prev: Option[Combiner[U, This]]) = result = pit.slice2combiner(from, until, reuse(prev, cbf()))
- def newSubtask(p: ParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
val sizes = pits.scanLeft(0)(_ + _.remaining)
@@ -877,11 +877,11 @@ extends IterableLike[T, Repr]
override def merge(that: Slice[U, This]) = result = result combine that.result
}
- protected[this] class SplitAt[U >: T, This >: Repr](at: Int, cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class SplitAt[U >: T, This >: Repr](at: Int, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[(Combiner[U, This], Combiner[U, This]), SplitAt[U, This]] {
var result: (Combiner[U, This], Combiner[U, This]) = null
def leaf(prev: Option[(Combiner[U, This], Combiner[U, This])]) = result = pit.splitAt2combiners(at, reuse(prev.map(_._1), cbf()), reuse(prev.map(_._2), cbf()))
- def newSubtask(p: ParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
val sizes = pits.scanLeft(0)(_ + _.remaining)
@@ -891,14 +891,14 @@ extends IterableLike[T, Repr]
}
protected[this] class TakeWhile[U >: T, This >: Repr]
- (pos: Int, pred: T => Boolean, cbf: () => Combiner[U, This], val pit: ParIterator)
+ (pos: Int, pred: T => Boolean, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[(Combiner[U, This], Boolean), TakeWhile[U, This]] {
var result: (Combiner[U, This], Boolean) = null
def leaf(prev: Option[(Combiner[U, This], Boolean)]) = if (pos < pit.indexFlag) {
result = pit.takeWhile2combiner(pred, reuse(prev.map(_._1), cbf()))
if (!result._2) pit.setIndexFlagIfLesser(pos)
} else result = (reuse(prev.map(_._1), cbf()), false)
- def newSubtask(p: ParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining)) yield new TakeWhile(pos + untilp, pred, cbf, p)
@@ -909,7 +909,7 @@ extends IterableLike[T, Repr]
}
protected[this] class Span[U >: T, This >: Repr]
- (pos: Int, pred: T => Boolean, cbf: () => Combiner[U, This], val pit: ParIterator)
+ (pos: Int, pred: T => Boolean, cbf: () => Combiner[U, This], protected[this] val pit: ParIterableIterator[T])
extends Transformer[(Combiner[U, This], Combiner[U, This]), Span[U, This]] {
var result: (Combiner[U, This], Combiner[U, This]) = null
def leaf(prev: Option[(Combiner[U, This], Combiner[U, This])]) = if (pos < pit.indexFlag) {
@@ -918,7 +918,7 @@ extends IterableLike[T, Repr]
} else {
result = (reuse(prev.map(_._2), cbf()), pit.copy2builder[U, This, Combiner[U, This]](reuse(prev.map(_._2), cbf())))
}
- def newSubtask(p: ParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining)) yield new Span(pos + untilp, pred, cbf, p)
@@ -930,11 +930,11 @@ extends IterableLike[T, Repr]
}
}
- protected[this] class CopyToArray[U >: T, This >: Repr](from: Int, len: Int, array: Array[U], val pit: ParIterator)
+ protected[this] class CopyToArray[U >: T, This >: Repr](from: Int, len: Int, array: Array[U], protected[this] val pit: ParIterableIterator[T])
extends Accessor[Unit, CopyToArray[U, This]] {
var result: Unit = ()
def leaf(prev: Option[Unit]) = pit.copyToArray(array, from, len)
- def newSubtask(p: ParIterator) = unsupported
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = unsupported
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining); if untilp < len) yield {
@@ -991,7 +991,7 @@ extends IterableLike[T, Repr]
}
}
- protected[this] class PartialScan[U >: T, A >: U](z: U, op: (U, U) => U, val from: Int, val len: Int, array: Array[A], val pit: ParIterator)
+ protected[this] class PartialScan[U >: T, A >: U](z: U, op: (U, U) => U, val from: Int, val len: Int, array: Array[A], protected[this] val pit: ParIterableIterator[T])
extends Accessor[ScanTree[U], PartialScan[U, A]] {
var result: ScanTree[U] = null
def leaf(prev: Option[ScanTree[U]]) = {
@@ -1007,7 +1007,7 @@ extends IterableLike[T, Repr]
result.value = array(from + len - 1).asInstanceOf[U]
if (from == 1) result.chunkFinished = true
}
- def newSubtask(p: ParIterator) = unsupported
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = unsupported
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining); if untilp < len) yield {
@@ -1077,7 +1077,7 @@ extends IterableLike[T, Repr]
}
}
- protected[this] class BuildScanTree[U >: T, A >: U](z: U, op: (U, U) => U, val from: Int, val len: Int, array: Array[A], val pit: ParIterator)
+ protected[this] class BuildScanTree[U >: T, A >: U](z: U, op: (U, U) => U, val from: Int, val len: Int, array: Array[A], protected[this] val pit: ParIterableIterator[T])
extends Accessor[ScanTree[U], BuildScanTree[U, A]] {
var result: ScanTree[U] = null
def leaf(prev: Option[ScanTree[U]]) = if ((prev != None && prev.get.chunkFinished) || from == 1) {
@@ -1090,7 +1090,7 @@ extends IterableLike[T, Repr]
result = new ScanTree[U](from, len)
result.value = pit.fold(z)(op)
}
- def newSubtask(p: ParIterator) = unsupported
+ protected[this] def newSubtask(p: ParIterableIterator[T]) = unsupported
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining); if untilp < len) yield {
diff --git a/src/library/scala/collection/parallel/ParSeqLike.scala b/src/library/scala/collection/parallel/ParSeqLike.scala
index dcad5b4094..7e8b9d6129 100644
--- a/src/library/scala/collection/parallel/ParSeqLike.scala
+++ b/src/library/scala/collection/parallel/ParSeqLike.scala
@@ -41,7 +41,7 @@ extends scala.collection.SeqLike[T, Repr]
with ParIterableLike[T, Repr, Sequential] {
self =>
- type SuperParIterator = super.ParIterator
+ type SuperParIterator = ParIterableIterator[T]
/** An iterator that can be split into arbitrary subsets of iterators.
* The self-type requirement ensures that the signal context passing behaviour gets mixed in
@@ -50,7 +50,7 @@ self =>
* '''Note:''' In concrete collection classes, collection implementers might want to override the iterator
* `reverse2builder` method to ensure higher efficiency.
*/
- trait ParIterator extends ParSeqIterator[T, Repr] with super.ParIterator {
+ trait ParIterator extends ParSeqIterator[T] with super.ParIterator {
me: SignalContextPassingIterator[ParIterator] =>
def split: Seq[ParIterator]
def psplit(sizes: Int*): Seq[ParIterator]
@@ -315,15 +315,15 @@ self =>
/* tasks */
- protected def down(p: SuperParIterator) = p.asInstanceOf[ParIterator]
+ protected[this] def down(p: ParIterableIterator[_]) = p.asInstanceOf[ParSeqIterator[T]]
protected trait Accessor[R, Tp] extends super.Accessor[R, Tp] {
- val pit: ParIterator
+ protected[this] val pit: ParSeqIterator[T]
}
protected trait Transformer[R, Tp] extends Accessor[R, Tp] with super.Transformer[R, Tp]
- protected[this] class SegmentLength(pred: T => Boolean, from: Int, val pit: ParIterator)
+ protected[this] class SegmentLength(pred: T => Boolean, from: Int, protected[this] val pit: ParSeqIterator[T])
extends Accessor[(Int, Boolean), SegmentLength] {
var result: (Int, Boolean) = null
def leaf(prev: Option[(Int, Boolean)]) = if (from < pit.indexFlag) {
@@ -332,7 +332,7 @@ self =>
result = (seglen, itsize == seglen)
if (!result._2) pit.setIndexFlagIfLesser(from)
} else result = (0, false)
- def newSubtask(p: SuperParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: SuperParIterator) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining)) yield new SegmentLength(pred, from + untilp, p)
@@ -340,7 +340,7 @@ self =>
override def merge(that: SegmentLength) = if (result._2) result = (result._1 + that.result._1, that.result._2)
}
- protected[this] class IndexWhere(pred: T => Boolean, from: Int, val pit: ParIterator)
+ protected[this] class IndexWhere(pred: T => Boolean, from: Int, protected[this] val pit: ParSeqIterator[T])
extends Accessor[Int, IndexWhere] {
var result: Int = -1
def leaf(prev: Option[Int]) = if (from < pit.indexFlag) {
@@ -350,7 +350,7 @@ self =>
pit.setIndexFlagIfLesser(from)
}
}
- def newSubtask(p: SuperParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: SuperParIterator) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(from)(_ + _.remaining)) yield new IndexWhere(pred, untilp, p)
@@ -360,7 +360,7 @@ self =>
}
}
- protected[this] class LastIndexWhere(pred: T => Boolean, pos: Int, val pit: ParIterator)
+ protected[this] class LastIndexWhere(pred: T => Boolean, pos: Int, protected[this] val pit: ParSeqIterator[T])
extends Accessor[Int, LastIndexWhere] {
var result: Int = -1
def leaf(prev: Option[Int]) = if (pos > pit.indexFlag) {
@@ -370,7 +370,7 @@ self =>
pit.setIndexFlagIfGreater(pos)
}
}
- def newSubtask(p: SuperParIterator) = throw new UnsupportedOperationException
+ protected[this] def newSubtask(p: SuperParIterator) = throw new UnsupportedOperationException
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(pos)(_ + _.remaining)) yield new LastIndexWhere(pred, untilp, p)
@@ -380,19 +380,19 @@ self =>
}
}
- protected[this] class Reverse[U >: T, This >: Repr](cbf: () => Combiner[U, This], val pit: ParIterator)
+ protected[this] class Reverse[U >: T, This >: Repr](cbf: () => Combiner[U, This], protected[this] val pit: ParSeqIterator[T])
extends Transformer[Combiner[U, This], Reverse[U, This]] {
var result: Combiner[U, This] = null
def leaf(prev: Option[Combiner[U, This]]) = result = pit.reverse2combiner(reuse(prev, cbf()))
- def newSubtask(p: SuperParIterator) = new Reverse(cbf, down(p))
+ protected[this] def newSubtask(p: SuperParIterator) = new Reverse(cbf, down(p))
override def merge(that: Reverse[U, This]) = result = that.result combine result
}
- protected[this] class ReverseMap[S, That](f: T => S, pbf: CanCombineFrom[Repr, S, That], val pit: ParIterator)
+ protected[this] class ReverseMap[S, That](f: T => S, pbf: CanCombineFrom[Repr, S, That], protected[this] val pit: ParSeqIterator[T])
extends Transformer[Combiner[S, That], ReverseMap[S, That]] {
var result: Combiner[S, That] = null
- def leaf(prev: Option[Combiner[S, That]]) = result = pit.reverseMap2combiner(f, pbf) // TODO
- def newSubtask(p: SuperParIterator) = new ReverseMap(f, pbf, down(p))
+ def leaf(prev: Option[Combiner[S, That]]) = result = pit.reverseMap2combiner(f, pbf(self.repr))
+ protected[this] def newSubtask(p: SuperParIterator) = new ReverseMap(f, pbf, down(p))
override def merge(that: ReverseMap[S, That]) = result = that.result combine result
}
@@ -403,7 +403,7 @@ self =>
result = pit.sameElements(otherpit)
if (!result) pit.abort
}
- def newSubtask(p: SuperParIterator) = unsupported
+ protected[this] def newSubtask(p: SuperParIterator) = unsupported
override def split = {
val fp = pit.remaining / 2
val sp = pit.remaining - fp
@@ -412,11 +412,11 @@ self =>
override def merge(that: SameElements[U]) = result = result && that.result
}
- protected[this] class Updated[U >: T, That](pos: Int, elem: U, pbf: CanCombineFrom[Repr, U, That], val pit: ParIterator)
+ protected[this] class Updated[U >: T, That](pos: Int, elem: U, pbf: CanCombineFrom[Repr, U, That], protected[this] val pit: ParSeqIterator[T])
extends Transformer[Combiner[U, That], Updated[U, That]] {
var result: Combiner[U, That] = null
- def leaf(prev: Option[Combiner[U, That]]) = result = pit.updated2combiner(pos, elem, pbf) // TODO
- def newSubtask(p: SuperParIterator) = unsupported
+ def leaf(prev: Option[Combiner[U, That]]) = result = pit.updated2combiner(pos, elem, pbf(self.repr))
+ protected[this] def newSubtask(p: SuperParIterator) = unsupported
override def split = {
val pits = pit.split
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining)) yield new Updated(pos - untilp, elem, pbf, p)
@@ -427,8 +427,8 @@ self =>
protected[this] class Zip[U >: T, S, That](len: Int, pbf: CanCombineFrom[Repr, (U, S), That], val pit: ParIterator, val otherpit: PreciseSplitter[S])
extends Transformer[Combiner[(U, S), That], Zip[U, S, That]] {
var result: Result = null
- def leaf(prev: Option[Result]) = result = pit.zip2combiner[U, S, That](otherpit)(pbf)
- def newSubtask(p: SuperParIterator) = unsupported
+ def leaf(prev: Option[Result]) = result = pit.zip2combiner[U, S, That](otherpit, pbf(self.repr))
+ protected[this] def newSubtask(p: SuperParIterator) = unsupported
override def split = {
val fp = len / 2
val sp = len - len / 2
@@ -449,7 +449,7 @@ self =>
result = pit.corresponds(corr)(otherpit)
if (!result) pit.abort
}
- def newSubtask(p: SuperParIterator) = unsupported
+ protected[this] def newSubtask(p: SuperParIterator) = unsupported
override def split = {
val fp = pit.remaining / 2
val sp = pit.remaining - fp
diff --git a/src/library/scala/collection/parallel/ParSeqViewLike.scala b/src/library/scala/collection/parallel/ParSeqViewLike.scala
index 6c41b17518..31b90936d7 100644
--- a/src/library/scala/collection/parallel/ParSeqViewLike.scala
+++ b/src/library/scala/collection/parallel/ParSeqViewLike.scala
@@ -161,11 +161,11 @@ extends SeqView[T, Coll]
/* tasks */
- protected[this] class Force[U >: T, That](cbf: CanCombineFrom[Coll, U, That], val pit: ParIterator)
+ protected[this] class Force[U >: T, That](cbf: CanCombineFrom[Coll, U, That], protected[this] val pit: ParSeqIterator[T])
extends Transformer[Combiner[U, That], Force[U, That]] {
var result: Combiner[U, That] = null
def leaf(prev: Option[Combiner[U, That]]) = result = pit.copy2builder[U, That, Combiner[U, That]](reuse(prev, cbf(self.underlying)))
- def newSubtask(p: SuperParIterator) = new Force(cbf, down(p))
+ protected[this] def newSubtask(p: SuperParIterator) = new Force(cbf, down(p))
override def merge(that: Force[U, That]) = result = result combine that.result
}
diff --git a/src/library/scala/collection/parallel/RemainsIterator.scala b/src/library/scala/collection/parallel/RemainsIterator.scala
index 18878a3bba..8296d92e59 100644
--- a/src/library/scala/collection/parallel/RemainsIterator.scala
+++ b/src/library/scala/collection/parallel/RemainsIterator.scala
@@ -9,6 +9,7 @@ import scala.collection.generic.CanCombineFrom
import scala.collection.mutable.Builder
import scala.collection.Iterator.empty
+
trait RemainsIterator[+T] extends Iterator[T] {
/** The number of elements this iterator has yet to iterate.
* This method doesn't change the state of the iterator.
@@ -21,11 +22,8 @@ trait RemainsIterator[+T] extends Iterator[T] {
* assuming they iterate an iterable collection.
*
* @param T type of the elements iterated.
- * @param Repr type of the collection iterator iterates.
*/
-trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T] {
-
- def repr: Repr
+trait AugmentedIterableIterator[+T] extends RemainsIterator[T] {
/* accessors */
@@ -95,8 +93,8 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
cb
}
- def collect2combiner[S, That](pf: PartialFunction[T, S], pbf: CanCombineFrom[Repr, S, That]): Combiner[S, That] = {
- val cb = pbf(repr)
+ def collect2combiner[S, That](pf: PartialFunction[T, S], cb: Combiner[S, That]): Combiner[S, That] = {
+ //val cb = pbf(repr)
while (hasNext) {
val curr = next
if (pf.isDefinedAt(curr)) cb += pf(curr)
@@ -104,8 +102,8 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
cb
}
- def flatmap2combiner[S, That](f: T => Traversable[S], pbf: CanCombineFrom[Repr, S, That]): Combiner[S, That] = {
- val cb = pbf(repr)
+ def flatmap2combiner[S, That](f: T => Traversable[S], cb: Combiner[S, That]): Combiner[S, That] = {
+ //val cb = pbf(repr)
while (hasNext) {
val traversable = f(next)
if (traversable.isInstanceOf[Iterable[_]]) cb ++= traversable.asInstanceOf[Iterable[S]].iterator
@@ -120,7 +118,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
b
}
- def filter2combiner[U >: T, This >: Repr](pred: T => Boolean, cb: Combiner[U, This]): Combiner[U, This] = {
+ def filter2combiner[U >: T, This](pred: T => Boolean, cb: Combiner[U, This]): Combiner[U, This] = {
while (hasNext) {
val curr = next
if (pred(curr)) cb += curr
@@ -128,7 +126,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
cb
}
- def filterNot2combiner[U >: T, This >: Repr](pred: T => Boolean, cb: Combiner[U, This]): Combiner[U, This] = {
+ def filterNot2combiner[U >: T, This](pred: T => Boolean, cb: Combiner[U, This]): Combiner[U, This] = {
while (hasNext) {
val curr = next
if (!pred(curr)) cb += curr
@@ -136,7 +134,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
cb
}
- def partition2combiners[U >: T, This >: Repr](pred: T => Boolean, btrue: Combiner[U, This], bfalse: Combiner[U, This]) = {
+ def partition2combiners[U >: T, This](pred: T => Boolean, btrue: Combiner[U, This], bfalse: Combiner[U, This]) = {
while (hasNext) {
val curr = next
if (pred(curr)) btrue += curr
@@ -145,7 +143,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
(btrue, bfalse)
}
- def take2combiner[U >: T, This >: Repr](n: Int, cb: Combiner[U, This]): Combiner[U, This] = {
+ def take2combiner[U >: T, This](n: Int, cb: Combiner[U, This]): Combiner[U, This] = {
cb.sizeHint(n)
var left = n
while (left > 0) {
@@ -155,14 +153,14 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
cb
}
- def drop2combiner[U >: T, This >: Repr](n: Int, cb: Combiner[U, This]): Combiner[U, This] = {
+ def drop2combiner[U >: T, This](n: Int, cb: Combiner[U, This]): Combiner[U, This] = {
drop(n)
cb.sizeHint(remaining)
while (hasNext) cb += next
cb
}
- def slice2combiner[U >: T, This >: Repr](from: Int, until: Int, cb: Combiner[U, This]): Combiner[U, This] = {
+ def slice2combiner[U >: T, This](from: Int, until: Int, cb: Combiner[U, This]): Combiner[U, This] = {
drop(from)
var left = until - from
cb.sizeHint(left)
@@ -173,7 +171,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
cb
}
- def splitAt2combiners[U >: T, This >: Repr](at: Int, before: Combiner[U, This], after: Combiner[U, This]) = {
+ def splitAt2combiners[U >: T, This](at: Int, before: Combiner[U, This], after: Combiner[U, This]) = {
before.sizeHint(at)
after.sizeHint(remaining - at)
var left = at
@@ -185,7 +183,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
(before, after)
}
- def takeWhile2combiner[U >: T, This >: Repr](p: T => Boolean, cb: Combiner[U, This]) = {
+ def takeWhile2combiner[U >: T, This](p: T => Boolean, cb: Combiner[U, This]) = {
var loop = true
while (hasNext && loop) {
val curr = next
@@ -195,7 +193,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
(cb, loop)
}
- def span2combiners[U >: T, This >: Repr](p: T => Boolean, before: Combiner[U, This], after: Combiner[U, This]) = {
+ def span2combiners[U >: T, This](p: T => Boolean, before: Combiner[U, This], after: Combiner[U, This]) = {
var isBefore = true
while (hasNext && isBefore) {
val curr = next
@@ -223,7 +221,7 @@ trait AugmentedIterableIterator[+T, +Repr <: Parallel] extends RemainsIterator[T
}
-trait AugmentedSeqIterator[+T, +Repr <: Parallel] extends AugmentedIterableIterator[T, Repr] {
+trait AugmentedSeqIterator[+T] extends AugmentedIterableIterator[T] {
/** The exact number of elements this iterator has yet to iterate.
* This method doesn't change the state of the iterator.
@@ -271,7 +269,7 @@ trait AugmentedSeqIterator[+T, +Repr <: Parallel] extends AugmentedIterableItera
/* transformers */
- def reverse2combiner[U >: T, This >: Repr](cb: Combiner[U, This]): Combiner[U, This] = {
+ def reverse2combiner[U >: T, This](cb: Combiner[U, This]): Combiner[U, This] = {
cb.sizeHint(remaining)
var lst = List[T]()
while (hasNext) lst ::= next
@@ -282,8 +280,8 @@ trait AugmentedSeqIterator[+T, +Repr <: Parallel] extends AugmentedIterableItera
cb
}
- def reverseMap2combiner[S, That](f: T => S, cbf: CanCombineFrom[Repr, S, That]): Combiner[S, That] = {
- val cb = cbf(repr)
+ def reverseMap2combiner[S, That](f: T => S, cb: Combiner[S, That]): Combiner[S, That] = {
+ //val cb = cbf(repr)
cb.sizeHint(remaining)
var lst = List[S]()
while (hasNext) lst ::= f(next)
@@ -294,8 +292,8 @@ trait AugmentedSeqIterator[+T, +Repr <: Parallel] extends AugmentedIterableItera
cb
}
- def updated2combiner[U >: T, That](index: Int, elem: U, cbf: CanCombineFrom[Repr, U, That]): Combiner[U, That] = {
- val cb = cbf(repr)
+ def updated2combiner[U >: T, That](index: Int, elem: U, cb: Combiner[U, That]): Combiner[U, That] = {
+ //val cb = cbf(repr)
cb.sizeHint(remaining)
var j = 0
while (hasNext) {
@@ -310,8 +308,8 @@ trait AugmentedSeqIterator[+T, +Repr <: Parallel] extends AugmentedIterableItera
/** Iterator `otherpit` must have equal or more elements.
*/
- def zip2combiner[U >: T, S, That](otherpit: Iterator[S])(implicit cbf: CanCombineFrom[Repr, (U, S), That]): Combiner[(U, S), That] = {
- val cb = cbf(repr)
+ def zip2combiner[U >: T, S, That](otherpit: Iterator[S], cb: Combiner[(U, S), That]): Combiner[(U, S), That] = {
+ //val cb = cbf(repr)
cb.sizeHint(remaining)
while (hasNext) {
cb += ((next, otherpit.next))
@@ -322,14 +320,13 @@ trait AugmentedSeqIterator[+T, +Repr <: Parallel] extends AugmentedIterableItera
}
-
-trait ParIterableIterator[+T, +Repr <: Parallel]
-extends AugmentedIterableIterator[T, Repr]
+trait ParIterableIterator[+T]
+extends AugmentedIterableIterator[T]
with Splitter[T]
with Signalling
with DelegatedSignalling
{
- def split: Seq[ParIterableIterator[T, Repr]]
+ def split: Seq[ParIterableIterator[T]]
/** The number of elements this iterator has yet to traverse. This method
* doesn't change the state of the iterator.
@@ -351,13 +348,13 @@ extends AugmentedIterableIterator[T, Repr]
}
-trait ParSeqIterator[+T, +Repr <: Parallel]
-extends ParIterableIterator[T, Repr]
- with AugmentedSeqIterator[T, Repr]
+trait ParSeqIterator[+T]
+extends ParIterableIterator[T]
+ with AugmentedSeqIterator[T]
with PreciseSplitter[T]
{
- def split: Seq[ParSeqIterator[T, Repr]]
- def psplit(sizes: Int*): Seq[ParSeqIterator[T, Repr]]
+ def split: Seq[ParSeqIterator[T]]
+ def psplit(sizes: Int*): Seq[ParSeqIterator[T]]
/** The number of elements this iterator has yet to traverse. This method
* doesn't change the state of the iterator. Unlike the version of this method in the supertrait,
@@ -370,62 +367,6 @@ extends ParIterableIterator[T, Repr]
}
-trait DelegatedIterator[+T, +Delegate <: Iterator[T]] extends RemainsIterator[T] {
- val delegate: Delegate
- def next = delegate.next
- def hasNext = delegate.hasNext
-}
-
-
-trait Counting[+T] extends RemainsIterator[T] {
- val initialSize: Int
- def remaining = initialSize - traversed
- var traversed = 0
- abstract override def next = {
- val n = super.next
- traversed += 1
- n
- }
-}
-
-
-/** A mixin for iterators that traverse only filtered elements of a delegate.
- */
-trait FilteredIterator[+T, +Delegate <: Iterator[T]] extends DelegatedIterator[T, Delegate] {
- protected[this] val pred: T => Boolean
-
- private[this] var hd: T = _
- private var hdDefined = false
-
- override def hasNext: Boolean = hdDefined || {
- do {
- if (!delegate.hasNext) return false
- hd = delegate.next
- } while (!pred(hd))
- hdDefined = true
- true
- }
-
- override def next = if (hasNext) { hdDefined = false; hd } else empty.next
-}
-
-
-/** A mixin for iterators that traverse elements of the delegate iterator, and of another collection.
- */
-trait AppendedIterator[+T, +Delegate <: Iterator[T]] extends DelegatedIterator[T, Delegate] {
- // `rest` should never alias `delegate`
- protected[this] val rest: Iterator[T]
-
- private[this] var current: Iterator[T] = delegate
-
- override def hasNext = (current.hasNext) || (current == delegate && rest.hasNext)
-
- override def next = {
- if (!current.hasNext) current = rest
- current.next
- }
-
-}
diff --git a/src/library/scala/collection/parallel/mutable/ParArray.scala b/src/library/scala/collection/parallel/mutable/ParArray.scala
index 1e1d3452d3..9b0049cb10 100644
--- a/src/library/scala/collection/parallel/mutable/ParArray.scala
+++ b/src/library/scala/collection/parallel/mutable/ParArray.scala
@@ -376,8 +376,8 @@ extends ParSeq[T]
}
}
- override def collect2combiner[S, That](pf: PartialFunction[T, S], pbf: CanCombineFrom[ParArray[T], S, That]): Combiner[S, That] = {
- val cb = pbf(self.repr)
+ override def collect2combiner[S, That](pf: PartialFunction[T, S], cb: Combiner[S, That]): Combiner[S, That] = {
+ //val cb = pbf(self.repr)
collect2combiner_quick(pf, arr, cb, until, i)
i = until
cb
@@ -392,8 +392,8 @@ extends ParSeq[T]
}
}
- override def flatmap2combiner[S, That](f: T => Traversable[S], pbf: CanCombineFrom[ParArray[T], S, That]): Combiner[S, That] = {
- val cb = pbf(self.repr)
+ override def flatmap2combiner[S, That](f: T => Traversable[S], cb: Combiner[S, That]): Combiner[S, That] = {
+ //val cb = pbf(self.repr)
while (i < until) {
val traversable = f(arr(i).asInstanceOf[T])
if (traversable.isInstanceOf[Iterable[_]]) cb ++= traversable.asInstanceOf[Iterable[S]].iterator
@@ -403,13 +403,13 @@ extends ParSeq[T]
cb
}
- override def filter2combiner[U >: T, This >: ParArray[T]](pred: T => Boolean, cb: Combiner[U, This]) = {
+ override def filter2combiner[U >: T, This](pred: T => Boolean, cb: Combiner[U, This]) = {
filter2combiner_quick(pred, cb, arr, until, i)
i = until
cb
}
- private def filter2combiner_quick[U >: T, This >: ParArray[T]](pred: T => Boolean, cb: Builder[U, This], a: Array[Any], ntil: Int, from: Int) {
+ private def filter2combiner_quick[U >: T, This](pred: T => Boolean, cb: Builder[U, This], a: Array[Any], ntil: Int, from: Int) {
var j = i
while(j < ntil) {
var curr = a(j).asInstanceOf[T]
@@ -418,13 +418,13 @@ extends ParSeq[T]
}
}
- override def filterNot2combiner[U >: T, This >: ParArray[T]](pred: T => Boolean, cb: Combiner[U, This]) = {
+ override def filterNot2combiner[U >: T, This](pred: T => Boolean, cb: Combiner[U, This]) = {
filterNot2combiner_quick(pred, cb, arr, until, i)
i = until
cb
}
- private def filterNot2combiner_quick[U >: T, This >: ParArray[T]](pred: T => Boolean, cb: Builder[U, This], a: Array[Any], ntil: Int, from: Int) {
+ private def filterNot2combiner_quick[U >: T, This](pred: T => Boolean, cb: Builder[U, This], a: Array[Any], ntil: Int, from: Int) {
var j = i
while(j < ntil) {
var curr = a(j).asInstanceOf[T]
@@ -454,13 +454,13 @@ extends ParSeq[T]
}
}
- override def partition2combiners[U >: T, This >: ParArray[T]](pred: T => Boolean, btrue: Combiner[U, This], bfalse: Combiner[U, This]) = {
+ override def partition2combiners[U >: T, This](pred: T => Boolean, btrue: Combiner[U, This], bfalse: Combiner[U, This]) = {
partition2combiners_quick(pred, btrue, bfalse, arr, until, i)
i = until
(btrue, bfalse)
}
- private def partition2combiners_quick[U >: T, This >: ParArray[T]](p: T => Boolean, btrue: Builder[U, This], bfalse: Builder[U, This], a: Array[Any], ntil: Int, from: Int) {
+ private def partition2combiners_quick[U >: T, This](p: T => Boolean, btrue: Builder[U, This], bfalse: Builder[U, This], a: Array[Any], ntil: Int, from: Int) {
var j = from
while (j < ntil) {
val curr = a(j).asInstanceOf[T]
@@ -469,7 +469,7 @@ extends ParSeq[T]
}
}
- override def take2combiner[U >: T, This >: ParArray[T]](n: Int, cb: Combiner[U, This]) = {
+ override def take2combiner[U >: T, This](n: Int, cb: Combiner[U, This]) = {
cb.sizeHint(n)
val ntil = i + n
val a = arr
@@ -480,7 +480,7 @@ extends ParSeq[T]
cb
}
- override def drop2combiner[U >: T, This >: ParArray[T]](n: Int, cb: Combiner[U, This]) = {
+ override def drop2combiner[U >: T, This](n: Int, cb: Combiner[U, This]) = {
drop(n)
cb.sizeHint(remaining)
while (i < until) {
@@ -490,7 +490,7 @@ extends ParSeq[T]
cb
}
- override def reverse2combiner[U >: T, This >: ParArray[T]](cb: Combiner[U, This]): Combiner[U, This] = {
+ override def reverse2combiner[U >: T, This](cb: Combiner[U, This]): Combiner[U, This] = {
cb.ifIs[ParArrayCombiner[T]] { pac =>
val sz = remaining
pac.sizeHint(sz)
diff --git a/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_view/SeqViewBenches.scala b/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_view/SeqViewBenches.scala
index 1328416b78..e84b25971b 100644
--- a/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_view/SeqViewBenches.scala
+++ b/test/benchmarks/src/scala/collection/parallel/benchmarks/parallel_view/SeqViewBenches.scala
@@ -17,7 +17,7 @@ import scala.collection.SeqView
trait DummyViewBenches
extends ParSeqViewBench[Dummy, ParSeqView[Dummy, ParSeq[Dummy], Seq[Dummy]], Seq[Dummy]] {
- def nameOfCollection = "ParallelView"
+ def nameOfCollection = "ParView"
def operators = DummyOperators
def comparisonMap = collection.Map()
val forkJoinPool = new scala.concurrent.forkjoin.ForkJoinPool