summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/parallel/ParSeqLike.scala
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-20 20:19:43 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-20 20:19:43 +0000
commiteeb70cd5f422e51d2be0658c4ad0b9e7f3d7b4fb (patch)
treecd9d135f97ec3dc433287ef99fa57b7e31d17925 /src/library/scala/collection/parallel/ParSeqLike.scala
parent2014160121a62681bdc0e873a3f7e9b5e3bbae16 (diff)
downloadscala-eeb70cd5f422e51d2be0658c4ad0b9e7f3d7b4fb.tar.gz
scala-eeb70cd5f422e51d2be0658c4ad0b9e7f3d7b4fb.tar.bz2
scala-eeb70cd5f422e51d2be0658c4ad0b9e7f3d7b4fb.zip
Refactoring certain tasks to accept empty split...
Refactoring certain tasks to accept empty splitters. Adding parallel mutable hash maps. No review
Diffstat (limited to 'src/library/scala/collection/parallel/ParSeqLike.scala')
-rw-r--r--src/library/scala/collection/parallel/ParSeqLike.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/library/scala/collection/parallel/ParSeqLike.scala b/src/library/scala/collection/parallel/ParSeqLike.scala
index f26ef0348c..d2e0f965d6 100644
--- a/src/library/scala/collection/parallel/ParSeqLike.scala
+++ b/src/library/scala/collection/parallel/ParSeqLike.scala
@@ -338,6 +338,7 @@ self =>
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining)) yield new SegmentLength(pred, from + untilp, p)
}
override def merge(that: SegmentLength) = if (result._2) result = (result._1 + that.result._1, that.result._2)
+ override def requiresStrictSplitters = true
}
protected[this] class IndexWhere(pred: T => Boolean, from: Int, protected[this] val pit: ParSeqIterator[T])
@@ -358,6 +359,7 @@ self =>
override def merge(that: IndexWhere) = result = if (result == -1) that.result else {
if (that.result != -1) result min that.result else result
}
+ override def requiresStrictSplitters = true
}
protected[this] class LastIndexWhere(pred: T => Boolean, pos: Int, protected[this] val pit: ParSeqIterator[T])
@@ -378,6 +380,7 @@ self =>
override def merge(that: LastIndexWhere) = result = if (result == -1) that.result else {
if (that.result != -1) result max that.result else result
}
+ override def requiresStrictSplitters = true
}
protected[this] class Reverse[U >: T, This >: Repr](cbf: () => Combiner[U, This], protected[this] val pit: ParSeqIterator[T])
@@ -410,6 +413,7 @@ self =>
for ((p, op) <- pit.psplit(fp, sp) zip otherpit.psplit(fp, sp)) yield new SameElements(p, op)
}
override def merge(that: SameElements[U]) = result = result && that.result
+ override def requiresStrictSplitters = true
}
protected[this] class Updated[U >: T, That](pos: Int, elem: U, pbf: CanCombineFrom[Repr, U, That], protected[this] val pit: ParSeqIterator[T])
@@ -422,6 +426,7 @@ self =>
for ((p, untilp) <- pits zip pits.scanLeft(0)(_ + _.remaining)) yield new Updated(pos - untilp, elem, pbf, p)
}
override def merge(that: Updated[U, That]) = result = result combine that.result
+ override def requiresStrictSplitters = true
}
protected[this] class Zip[U >: T, S, That](len: Int, pbf: CanCombineFrom[Repr, (U, S), That], protected[this] val pit: ParSeqIterator[T], val otherpit: ParSeqIterator[S])
@@ -456,6 +461,7 @@ self =>
for ((p, op) <- pit.psplit(fp, sp) zip otherpit.psplit(fp, sp)) yield new Corresponds(corr, p, op)
}
override def merge(that: Corresponds[S]) = result = result && that.result
+ override def requiresStrictSplitters = true
}
}