summaryrefslogtreecommitdiff
path: root/test/files/scalacheck/parallel-collections/PairOperators.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-18 00:09:46 -0700
committerPaul Phillips <paulp@improving.org>2013-09-18 07:13:38 -0700
commitf4267ccd96a9143c910c66a5b0436aaa64b7c9dc (patch)
tree174861715807c23ba332f78769a9f7e1377b7f02 /test/files/scalacheck/parallel-collections/PairOperators.scala
parentd45a3c8cc8e9f1d95d797d548a85abd8597f5bc7 (diff)
downloadscala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.gz
scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.tar.bz2
scala-f4267ccd96a9143c910c66a5b0436aaa64b7c9dc.zip
Cull extraneous whitespace.
One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in.
Diffstat (limited to 'test/files/scalacheck/parallel-collections/PairOperators.scala')
-rw-r--r--test/files/scalacheck/parallel-collections/PairOperators.scala42
1 files changed, 21 insertions, 21 deletions
diff --git a/test/files/scalacheck/parallel-collections/PairOperators.scala b/test/files/scalacheck/parallel-collections/PairOperators.scala
index 4711e21c34..fe851114be 100644
--- a/test/files/scalacheck/parallel-collections/PairOperators.scala
+++ b/test/files/scalacheck/parallel-collections/PairOperators.scala
@@ -7,76 +7,76 @@ import scala.collection.parallel._
trait PairOperators[K, V] extends Operators[(K, V)] {
def koperators: Operators[K]
def voperators: Operators[V]
-
+
private def zipPredicates(kps: List[K => Boolean], vps: List[V => Boolean]): List[((K, V)) => Boolean] = for {
(kp, vp) <- koperators.countPredicates zip voperators.countPredicates
} yield new Function1[(K, V), Boolean] {
def apply(kv: (K, V)) = kp(kv._1) && vp(kv._2)
}
-
+
/* operators */
-
+
def reduceOperators = for {
(kop, vop) <- koperators.reduceOperators zip voperators.reduceOperators
} yield new Function2[(K, V), (K, V), (K, V)] {
def apply(kv1: (K, V), kv2: (K, V)) = (kop(kv1._1, kv2._1), vop(kv1._2, kv2._2))
}
-
+
def countPredicates = zipPredicates(koperators.countPredicates, voperators.countPredicates)
-
+
def forallPredicates = zipPredicates(koperators.forallPredicates, voperators.forallPredicates)
-
+
def existsPredicates = zipPredicates(koperators.existsPredicates, voperators.existsPredicates)
-
+
def findPredicates = zipPredicates(koperators.findPredicates, voperators.findPredicates)
-
+
def mapFunctions = for {
(km, vm) <- koperators.mapFunctions zip voperators.mapFunctions
} yield new Function1[(K, V), (K, V)] {
def apply(kv: (K, V)) = (km(kv._1), vm(kv._2))
}
-
+
def partialMapFunctions = for {
(kpm, vpm) <- koperators.partialMapFunctions zip voperators.partialMapFunctions
} yield new PartialFunction[(K, V), (K, V)] {
def isDefinedAt(kv: (K, V)) = kpm.isDefinedAt(kv._1) && vpm.isDefinedAt(kv._2)
def apply(kv: (K, V)) = (kpm(kv._1), vpm(kv._2))
}
-
+
def flatMapFunctions = for {
(kfm, vfm) <- koperators.flatMapFunctions zip voperators.flatMapFunctions
} yield new Function1[(K, V), Traversable[(K, V)]] {
def apply(kv: (K, V)) = kfm(kv._1).toIterable zip vfm(kv._2).toIterable
}
-
+
def filterPredicates = zipPredicates(koperators.filterPredicates, voperators.filterPredicates)
-
+
def filterNotPredicates = filterPredicates
-
+
def partitionPredicates = filterPredicates
-
+
def takeWhilePredicates = zipPredicates(koperators.takeWhilePredicates, voperators.takeWhilePredicates)
-
+
def dropWhilePredicates = takeWhilePredicates
-
+
def spanPredicates = takeWhilePredicates
-
+
def foldArguments = for {
((kinit, kop), (vinit, vop)) <- koperators.foldArguments zip voperators.foldArguments
} yield ((kinit, vinit), new Function2[(K, V), (K, V), (K, V)] {
def apply(kv1: (K, V), kv2: (K, V)) = (kop(kv1._1, kv2._1), vop(kv1._2, kv2._2))
})
-
+
def addAllTraversables = for {
(kt, vt) <- koperators.addAllTraversables zip voperators.addAllTraversables
} yield kt.toIterable zip vt.toIterable
-
+
def newArray(sz: Int) = new Array[(K, V)](sz)
-
+
def groupByFunctions = (koperators.groupByFunctions zip voperators.groupByFunctions) map {
opt => { (p: (K, V)) => (opt._1(p._1), opt._2(p._2)) }
}
-
+
}