diff options
author | Paul Phillips <paulp@improving.org> | 2011-08-09 22:24:53 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-08-09 22:24:53 +0000 |
commit | 333f540595b5cc80879758f656cccd99632d3fd5 (patch) | |
tree | ca2fb4419a433c7af3755e2faa384ae3d3c7bf4c /src/library/scala/collection/parallel/immutable/package.scala | |
parent | 87aca406769cf3c90f375fcf03d9b47725591650 (diff) | |
download | scala-333f540595b5cc80879758f656cccd99632d3fd5.tar.gz scala-333f540595b5cc80879758f656cccd99632d3fd5.tar.bz2 scala-333f540595b5cc80879758f656cccd99632d3fd5.zip |
Moved the classes and objects which are defined...
Moved the classes and objects which are defined in package objects out.
In principle this is something you should be able to do. In practice
right now it means bugs, to no advantage.
I also deprecated RangeUtils, an unused, undocumented trait in the
immutable package. It seems like there is a ton of stuff in the public
API which should not be in the public API. It's really tedious having to
go through a whole deprecation cycle to dispose of what could have been
an internal-only class (and was presumably intended as such given the
the absence of documentation.)
No review.
Diffstat (limited to 'src/library/scala/collection/parallel/immutable/package.scala')
-rw-r--r-- | src/library/scala/collection/parallel/immutable/package.scala | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/library/scala/collection/parallel/immutable/package.scala b/src/library/scala/collection/parallel/immutable/package.scala index 19f8665667..7b1e39d092 100644 --- a/src/library/scala/collection/parallel/immutable/package.scala +++ b/src/library/scala/collection/parallel/immutable/package.scala @@ -8,15 +8,7 @@ package scala.collection.parallel -package object immutable { - - /* package level methods */ - def repetition[T](elem: T, len: Int) = new Repetition(elem, len) - - /* constants */ - - /* classes */ - +package immutable { /** A (parallel) sequence consisting of `length` elements `elem`. Used in the `padTo` method. * * @tparam T type of the elements @@ -24,7 +16,8 @@ package object immutable { * @param length the length of the collection */ private[parallel] class Repetition[T](elem: T, val length: Int) extends ParSeq[T] { - self => + self => + def apply(idx: Int) = if (0 <= idx && idx < length) elem else throw new IndexOutOfBoundsException("" + idx) override def seq = throw new UnsupportedOperationException def update(idx: Int, elem: T) = throw new UnsupportedOperationException @@ -32,7 +25,8 @@ package object immutable { type SCPI = SignalContextPassingIterator[ParIterator] class ParIterator(var i: Int = 0, val until: Int = length, elem: T = self.elem) extends super.ParIterator { - me: SignalContextPassingIterator[ParIterator] => + me: SignalContextPassingIterator[ParIterator] => + def remaining = until - i def hasNext = i < until def next = { i += 1; elem } @@ -45,6 +39,10 @@ package object immutable { } def splitter = new ParIterator with SCPI - } } + +package object immutable { + /* package level methods */ + def repetition[T](elem: T, len: Int) = new Repetition(elem, len) +} |