summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiark Rompf <tiark.rompf@epfl.ch>2009-10-21 21:13:58 +0000
committerTiark Rompf <tiark.rompf@epfl.ch>2009-10-21 21:13:58 +0000
commit2816f2e6ce51206b3b5bdb1367203bf688625cb6 (patch)
treeb624f91e8b6789f3cdbe216d7f9068edb6cb469b
parentc570e1e7af9762a513f976e4fc5187a6a6efa271 (diff)
downloadscala-2816f2e6ce51206b3b5bdb1367203bf688625cb6.tar.gz
scala-2816f2e6ce51206b3b5bdb1367203bf688625cb6.tar.bz2
scala-2816f2e6ce51206b3b5bdb1367203bf688625cb6.zip
renamed Vector to IndexedSeq
-rw-r--r--lib/scala-compiler.jar.desired.sha12
-rw-r--r--lib/scala-library-src.jar.desired.sha12
-rw-r--r--lib/scala-library.jar.desired.sha12
-rw-r--r--src/compiler/scala/tools/ant/ScalaBazaar.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala2
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala2
-rw-r--r--src/library/scala/Array.scala6
-rw-r--r--src/library/scala/LowPriorityImplicits.scala10
-rw-r--r--src/library/scala/Predef.scala2
-rw-r--r--src/library/scala/collection/IndexedSeq.scala (renamed from src/library/scala/collection/Vector.scala)20
-rw-r--r--src/library/scala/collection/IndexedSeqLike.scala (renamed from src/library/scala/collection/VectorLike.scala)16
-rw-r--r--src/library/scala/collection/IndexedSeqView.scala (renamed from src/library/scala/collection/VectorView.scala)12
-rw-r--r--src/library/scala/collection/IndexedSeqViewLike.scala (renamed from src/library/scala/collection/VectorViewLike.scala)14
-rw-r--r--src/library/scala/collection/Iterator.scala4
-rw-r--r--src/library/scala/collection/TraversableLike.scala4
-rw-r--r--src/library/scala/collection/generic/GenericTraversableTemplate.scala2
-rw-r--r--src/library/scala/collection/immutable/GenericRange.scala4
-rw-r--r--src/library/scala/collection/immutable/IndexedSeq.scala (renamed from src/library/scala/collection/immutable/Vector.scala)137
-rw-r--r--src/library/scala/collection/immutable/List.scala4
-rw-r--r--src/library/scala/collection/immutable/PagedSeq.scala2
-rw-r--r--src/library/scala/collection/immutable/Range.scala2
-rw-r--r--src/library/scala/collection/immutable/Stream.scala4
-rw-r--r--src/library/scala/collection/immutable/StringLike.scala2
-rw-r--r--src/library/scala/collection/immutable/WrappedString.scala2
-rw-r--r--src/library/scala/collection/interfaces/TraversableMethods.scala2
-rw-r--r--src/library/scala/collection/mutable/ArrayBuffer.scala4
-rw-r--r--src/library/scala/collection/mutable/ArrayLike.scala12
-rw-r--r--src/library/scala/collection/mutable/BufferLike.scala2
-rw-r--r--src/library/scala/collection/mutable/GenericArray.scala4
-rw-r--r--src/library/scala/collection/mutable/IndexedSeq.scala (renamed from src/library/scala/collection/mutable/Vector.scala)18
-rw-r--r--src/library/scala/collection/mutable/IndexedSeqLike.scala (renamed from src/library/scala/collection/mutable/VectorLike.scala)10
-rw-r--r--src/library/scala/collection/mutable/IndexedSeqView.scala (renamed from src/library/scala/collection/mutable/VectorView.scala)38
-rw-r--r--src/library/scala/collection/mutable/ResizableArray.scala6
-rw-r--r--src/library/scala/collection/mutable/StringBuilder.scala6
-rw-r--r--src/library/scala/collection/mutable/WrappedArray.scala4
-rw-r--r--src/library/scala/package.scala8
-rw-r--r--src/library/scala/runtime/BoxedArray.scala10
-rw-r--r--src/library/scala/runtime/RichChar.scala14
-rw-r--r--src/library/scala/runtime/RichString.scala6
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala2
-rw-r--r--src/library/scala/util/Random.scala2
-rw-r--r--src/library/scala/util/automata/WordBerrySethi.scala2
-rw-r--r--src/msil/ch/epfl/lamp/compiler/msil/tests/TableDump.java2
-rw-r--r--src/partest/scala/tools/partest/nest/Diff.java20
-rw-r--r--src/swing/scala/swing/BufferWrapper.scala4
-rw-r--r--src/swing/scala/swing/Table.scala4
-rw-r--r--test/files/run/sequenceComparisons.scala2
-rwxr-xr-xtest/files/run/viewtest.scala2
48 files changed, 225 insertions, 218 deletions
diff --git a/lib/scala-compiler.jar.desired.sha1 b/lib/scala-compiler.jar.desired.sha1
index 18aecb6c18..1afefb0069 100644
--- a/lib/scala-compiler.jar.desired.sha1
+++ b/lib/scala-compiler.jar.desired.sha1
@@ -1 +1 @@
-a68c666e5fdd3c2e6f389ecde369f5c6718d1a6e ?scala-compiler.jar
+25ca20b2d26a533d50a7c9bf8c10ddcdc43a0320 ?scala-compiler.jar
diff --git a/lib/scala-library-src.jar.desired.sha1 b/lib/scala-library-src.jar.desired.sha1
index db30e99cc5..1eb230897d 100644
--- a/lib/scala-library-src.jar.desired.sha1
+++ b/lib/scala-library-src.jar.desired.sha1
@@ -1 +1 @@
-053c14f50d18cbaba66b747b2739bbc8dacef0f5 ?scala-library-src.jar
+3610a5e08a2811468685e542743eb5f281c1ed66 ?scala-library-src.jar
diff --git a/lib/scala-library.jar.desired.sha1 b/lib/scala-library.jar.desired.sha1
index 7f8055b117..d499702f08 100644
--- a/lib/scala-library.jar.desired.sha1
+++ b/lib/scala-library.jar.desired.sha1
@@ -1 +1 @@
-4ae7d29d34a187321e703462f2d1c62e0b650731 ?scala-library.jar
+5b25bbba4324bafa998a5f6e6f4cc51c494e0d2a ?scala-library.jar
diff --git a/src/compiler/scala/tools/ant/ScalaBazaar.scala b/src/compiler/scala/tools/ant/ScalaBazaar.scala
index aba6835eae..a6e44f95c3 100644
--- a/src/compiler/scala/tools/ant/ScalaBazaar.scala
+++ b/src/compiler/scala/tools/ant/ScalaBazaar.scala
@@ -16,7 +16,7 @@ package scala.tools.ant {
import java.io.{File, FileInputStream, FileOutputStream,
FileWriter, StringReader}
import java.net.URL
- import java.util.{ArrayList, Vector}
+ import java.util.ArrayList
import java.util.zip.{ZipOutputStream, ZipEntry}
import org.apache.tools.ant.{AntClassLoader, BuildException,
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 6aa18d583f..07d47a73a1 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -172,7 +172,7 @@ trait Definitions {
lazy val SeqModule = getModule2("scala.Seq", "scala.collection.Seq")
def Seq_length = getMember(SeqClass, nme.length)
lazy val RandomAccessSeqMutableClass = getMember(
- getModule2("scala.RandomAccessSeq", "scala.collection.Vector"), nme.Mutable)
+ getModule2("scala.RandomAccessSeq", "scala.collection.IndexedSeq"), nme.Mutable)
lazy val ListModule = getModule2("scala.List", "scala.collection.immutable.List")
def List_apply = getMember(ListModule, nme.apply)
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 89cbb9c7b5..cdb3a2eb8e 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -4894,6 +4894,6 @@ A type's typeSymbol should never be inspected directly.
"scala.collection.Traversable",
"scala.collection.Iterable",
"scala.collection.mutable.StringBuilder",
- "scala.collection.Vector",
+ "scala.collection.IndexedSeq",
"scala.collection.Iterator")
}
diff --git a/src/library/scala/Array.scala b/src/library/scala/Array.scala
index 30c1b99b83..dcc64135c4 100644
--- a/src/library/scala/Array.scala
+++ b/src/library/scala/Array.scala
@@ -13,7 +13,7 @@ package scala
import scala.collection.generic._
import scala.collection.Traversable
-import scala.collection.mutable.{Vector, ArrayBuilder, GenericArray}
+import scala.collection.mutable.{IndexedSeq, ArrayBuilder, GenericArray}
import compat.Platform.arraycopy
import scala.reflect.ClassManifest
import scala.runtime.ScalaRunTime.{array_apply, array_update}
@@ -377,8 +377,8 @@ object Array extends FallbackArrayBuilding {
* @param x the selector value
* @return sequence wrapped in an option, if this is a Seq, otherwise none
*/
- def unapplySeq[T](x: Array[T]): Option[Vector[T]] =
- if (x == null) None else Some(x.toVector)
+ def unapplySeq[T](x: Array[T]): Option[IndexedSeq[T]] =
+ if (x == null) None else Some(x.toIndexedSeq)
// !!! the null check should to be necessary, but without it 2241 fails. Seems to be a bug
// in pattern matcher.
diff --git a/src/library/scala/LowPriorityImplicits.scala b/src/library/scala/LowPriorityImplicits.scala
index 376823e619..acfb8b3ceb 100644
--- a/src/library/scala/LowPriorityImplicits.scala
+++ b/src/library/scala/LowPriorityImplicits.scala
@@ -12,7 +12,7 @@
package scala
import collection.mutable._
-import collection.immutable.{WrappedString, Vector}
+import collection.immutable.{WrappedString, IndexedSeq}
import collection.generic.CanBuildFrom
/** The `LowPriorityImplicits` class provides implicit values that
@@ -42,10 +42,10 @@ class LowPriorityImplicits {
implicit def wrapString(s: String): WrappedString = new WrappedString(s)
implicit def unwrapString(ws: WrappedString): String = ws.self
- implicit def fallbackStringCanBuildFrom[T]: CanBuildFrom[String, T, collection.immutable.Vector[T]] =
- new CanBuildFrom[String, T, collection.immutable.Vector[T]] {
- def apply(from: String) = scala.collection.immutable.Vector.newBuilder[T]
- def apply() = scala.collection.immutable.Vector.newBuilder[T]
+ implicit def fallbackStringCanBuildFrom[T]: CanBuildFrom[String, T, collection.immutable.IndexedSeq[T]] =
+ new CanBuildFrom[String, T, collection.immutable.IndexedSeq[T]] {
+ def apply(from: String) = scala.collection.immutable.IndexedSeq.newBuilder[T]
+ def apply() = scala.collection.immutable.IndexedSeq.newBuilder[T]
}
/** Can go away after next newstarr */
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 12cf8615d3..cab32b0595 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -289,7 +289,7 @@ object Predef extends LowPriorityImplicits {
//implicit def lazyStreamToConsable[A](xs: => Stream[A]) = new runtime.StreamCons(xs)
- implicit def seqToCharSequence(xs: collection.Vector[Char]): CharSequence = new CharSequence {
+ implicit def seqToCharSequence(xs: collection.IndexedSeq[Char]): CharSequence = new CharSequence {
def length: Int = xs.length
def charAt(index: Int): Char = xs(index)
def subSequence(start: Int, end: Int): CharSequence = seqToCharSequence(xs.slice(start, end))
diff --git a/src/library/scala/collection/Vector.scala b/src/library/scala/collection/IndexedSeq.scala
index 053cbfd74d..d7945402bb 100644
--- a/src/library/scala/collection/Vector.scala
+++ b/src/library/scala/collection/IndexedSeq.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Vector.scala 19035 2009-10-10 22:54:28Z rompf $
+// $Id: IndexedSeq.scala 19035 2009-10-10 22:54:28Z rompf $
package scala.collection
@@ -27,19 +27,19 @@ import scala.collection.mutable.Builder
* @version 2.8
* @since 2.8
*/
-trait Vector[+A] extends Seq[A]
- with GenericTraversableTemplate[A, Vector]
- with VectorLike[A, Vector[A]] {
- override def companion: GenericCompanion[Vector] = Vector
+trait IndexedSeq[+A] extends Seq[A]
+ with GenericTraversableTemplate[A, IndexedSeq]
+ with IndexedSeqLike[A, IndexedSeq[A]] {
+ override def companion: GenericCompanion[IndexedSeq] = IndexedSeq
}
-object Vector extends SeqFactory[Vector] {
- override def empty[A]: Vector[A] = immutable.Vector.empty[A]
- implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] =
+object IndexedSeq extends SeqFactory[IndexedSeq] {
+ override def empty[A]: IndexedSeq[A] = immutable.IndexedSeq.empty[A]
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IndexedSeq[A]] =
new GenericCanBuildFrom[A] {
def apply() = newBuilder[A]
}
- def newBuilder[A]: Builder[A, Vector[A]] = immutable.Vector.newBuilder[A]
+ def newBuilder[A]: Builder[A, IndexedSeq[A]] = immutable.IndexedSeq.newBuilder[A]
- @deprecated("use collection.mutable.Vector instead") type Mutable[A] = scala.collection.mutable.Vector[A]
+ @deprecated("use collection.mutable.IndexedSeq instead") type Mutable[A] = scala.collection.mutable.IndexedSeq[A]
}
diff --git a/src/library/scala/collection/VectorLike.scala b/src/library/scala/collection/IndexedSeqLike.scala
index 79c07cda60..74d872665d 100644
--- a/src/library/scala/collection/VectorLike.scala
+++ b/src/library/scala/collection/IndexedSeqLike.scala
@@ -24,10 +24,10 @@ import scala.annotation.tailrec
* @version 2.8
* @since 2.8
*/
-trait VectorLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
+trait IndexedSeqLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
- override protected[this] def thisCollection: Vector[A] = this.asInstanceOf[Vector[A]]
- override protected[this] def toCollection(repr: Repr): Vector[A] = repr.asInstanceOf[Vector[A]]
+ override protected[this] def thisCollection: IndexedSeq[A] = this.asInstanceOf[IndexedSeq[A]]
+ override protected[this] def toCollection(repr: Repr): IndexedSeq[A] = repr.asInstanceOf[IndexedSeq[A]]
// Overridden methods from IterableLike
@@ -98,7 +98,7 @@ trait VectorLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
if (length > 0) foldr(0, length - 1, this(length - 1), op) else super.reduceRight(op)
override def zip[A1 >: A, B, That](that: Iterable[B])(implicit bf: CanBuildFrom[Repr, (A1, B), That]): That = that match {
- case that: Vector[_] =>
+ case that: IndexedSeq[_] =>
val b = bf(repr)
var i = 0
val len = this.length min that.length
@@ -150,7 +150,7 @@ trait VectorLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
override def span(p: A => Boolean): (Repr, Repr) = splitAt(prefixLength(p))
override def sameElements[B >: A](that: Iterable[B]): Boolean = that match {
- case that: Vector[_] =>
+ case that: IndexedSeq[_] =>
val len = length
len == that.length && {
var i = 0
@@ -220,7 +220,7 @@ trait VectorLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
}
override def startsWith[B](that: Seq[B], offset: Int): Boolean = that match {
- case that: Vector[_] =>
+ case that: IndexedSeq[_] =>
var i = offset
var j = 0
val thisLen = length
@@ -244,7 +244,7 @@ trait VectorLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
}
override def endsWith[B](that: Seq[B]): Boolean = that match {
- case that: Vector[_] =>
+ case that: IndexedSeq[_] =>
var i = length - 1
var j = that.length - 1
@@ -261,7 +261,7 @@ trait VectorLike[+A, +Repr] extends SeqLike[A, Repr] { self =>
super.endsWith(that)
}
- override def view = new VectorView[A, Repr] {
+ override def view = new IndexedSeqView[A, Repr] {
protected lazy val underlying = self.repr
override def iterator = self.iterator
override def length = self.length
diff --git a/src/library/scala/collection/VectorView.scala b/src/library/scala/collection/IndexedSeqView.scala
index 2611d461c4..e693ff36e5 100644
--- a/src/library/scala/collection/VectorView.scala
+++ b/src/library/scala/collection/IndexedSeqView.scala
@@ -21,17 +21,17 @@ import generic._
* @version 2.8
* @since 2.8
*/
-trait VectorView[+A, +Coll] extends VectorViewLike[A, Coll, VectorView[A, Coll]]
+trait IndexedSeqView[+A, +Coll] extends IndexedSeqViewLike[A, Coll, IndexedSeqView[A, Coll]]
-object VectorView {
+object IndexedSeqView {
type Coll = TraversableView[_, C] forSome {type C <: Traversable[_]}
- implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, VectorView[A, Vector[_]]] =
- new CanBuildFrom[Coll, A, VectorView[A, Vector[_]]] {
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IndexedSeqView[A, IndexedSeq[_]]] =
+ new CanBuildFrom[Coll, A, IndexedSeqView[A, IndexedSeq[_]]] {
def apply(from: Coll) = new NoBuilder
def apply() = new NoBuilder
}
- implicit def arrCanBuildFrom[A]: CanBuildFrom[TraversableView[_, Array[_]], A, VectorView[A, Array[A]]] =
- new CanBuildFrom[TraversableView[_, Array[_]], A, VectorView[A, Array[A]]] {
+ implicit def arrCanBuildFrom[A]: CanBuildFrom[TraversableView[_, Array[_]], A, IndexedSeqView[A, Array[A]]] =
+ new CanBuildFrom[TraversableView[_, Array[_]], A, IndexedSeqView[A, Array[A]]] {
def apply(from: TraversableView[_, Array[_]]) = new NoBuilder
def apply() = new NoBuilder
}
diff --git a/src/library/scala/collection/VectorViewLike.scala b/src/library/scala/collection/IndexedSeqViewLike.scala
index fa8b31301a..ca4e99de07 100644
--- a/src/library/scala/collection/VectorViewLike.scala
+++ b/src/library/scala/collection/IndexedSeqViewLike.scala
@@ -14,23 +14,23 @@ package scala.collection
import generic._
import TraversableView.NoBuilder
-/** A template trait for a non-strict view of a vector.
+/** A template trait for a non-strict view of a IndexedSeq.
*
* @author Sean McDirmid
* @author Martin Odersky
* @version 2.8
* @since 2.8
*/
-trait VectorViewLike[+A,
+trait IndexedSeqViewLike[+A,
+Coll,
- +This <: VectorView[A, Coll] with VectorViewLike[A, Coll, This]]
- extends Vector[A] with VectorLike[A, This] with SeqView[A, Coll] with SeqViewLike[A, Coll, This]
+ +This <: IndexedSeqView[A, Coll] with IndexedSeqViewLike[A, Coll, This]]
+ extends IndexedSeq[A] with IndexedSeqLike[A, This] with SeqView[A, Coll] with SeqViewLike[A, Coll, This]
{ self =>
- trait Transformed[+B] extends VectorView[B, Coll] with super.Transformed[B]
+ trait Transformed[+B] extends IndexedSeqView[B, Coll] with super.Transformed[B]
trait Sliced extends Transformed[A] with super.Sliced {
- /** Override to use Vector's foreach; todo: see whether this is really faster */
+ /** Override to use IndexedSeq's foreach; todo: see whether this is really faster */
override def foreach[U](f: A => U) = super[Transformed].foreach(f)
}
@@ -105,5 +105,5 @@ trait VectorViewLike[+A,
protected override def newPatched[B >: A](_from: Int, _patch: Seq[B], _replaced: Int): Transformed[B] = new Patched[B] {
val from = _from; val patch = _patch; val replaced = _replaced
}
- override def stringPrefix = "VectorView"
+ override def stringPrefix = "IndexedSeqView"
}
diff --git a/src/library/scala/collection/Iterator.scala b/src/library/scala/collection/Iterator.scala
index 5c7e2b6c3b..e5a9e3c075 100644
--- a/src/library/scala/collection/Iterator.scala
+++ b/src/library/scala/collection/Iterator.scala
@@ -172,7 +172,7 @@ object Iterator {
/**
* @param xs the array of elements
- * @see also: Vector.iterator and slice
+ * @see also: IndexedSeq.iterator and slice
*/
@deprecated("use `xs.iterator' instead")
def fromArray[a](xs: Array[a]): Iterator[a] =
@@ -182,7 +182,7 @@ object Iterator {
* @param xs the array of elements
* @param start the start index
* @param length the length
- * @see also: Vector.iterator and slice
+ * @see also: IndexedSeq.iterator and slice
*/
@deprecated("use `xs.slice(start, start + length).iterator' instead")
def fromArray[a](xs: Array[a], start: Int, length: Int): Iterator[a] =
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index 9c066ab10e..788e45097e 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -720,10 +720,10 @@ self =>
*/
def toSeq: Seq[A] = toList
- /** Returns a vector with all elements in this traversable object.
+ /** Returns a IndexedSeq with all elements in this traversable object.
* @note Will not terminate for infinite-sized collections.
*/
- def toVector[B >: A]: mutable.Vector[B] = (new ArrayBuffer[B] ++= thisCollection)
+ def toIndexedSeq[B >: A]: mutable.IndexedSeq[B] = (new ArrayBuffer[B] ++= thisCollection)
/** Returns a stream with all elements in this traversable object.
*/
diff --git a/src/library/scala/collection/generic/GenericTraversableTemplate.scala b/src/library/scala/collection/generic/GenericTraversableTemplate.scala
index dfa31d686b..50a7aa3fe0 100644
--- a/src/library/scala/collection/generic/GenericTraversableTemplate.scala
+++ b/src/library/scala/collection/generic/GenericTraversableTemplate.scala
@@ -52,7 +52,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: Traversable[X]] {
}
def transpose[B](implicit asTraversable: A => /*<:<!!!*/ Traversable[B]): CC[CC[B] @uncheckedVariance] = {
- val bs: Vector[Builder[B, CC[B]]] = asTraversable(head).map(_ => genericBuilder[B]).toVector
+ val bs: IndexedSeq[Builder[B, CC[B]]] = asTraversable(head).map(_ => genericBuilder[B]).toIndexedSeq
for (xs <- this) {
var i = 0
for (x <- asTraversable(xs)) {
diff --git a/src/library/scala/collection/immutable/GenericRange.scala b/src/library/scala/collection/immutable/GenericRange.scala
index 1fd977d7e8..b541b900a0 100644
--- a/src/library/scala/collection/immutable/GenericRange.scala
+++ b/src/library/scala/collection/immutable/GenericRange.scala
@@ -38,7 +38,7 @@ import generic._
abstract class GenericRange[+T]
(val start: T, val end: T, val step: T, val isInclusive: Boolean)
(implicit num: Integral[T])
-extends Vector[T]
+extends IndexedSeq[T]
{
import num._
@@ -60,7 +60,7 @@ extends Vector[T]
protected def limitTest[U >: T](x: U)(implicit unum: Integral[U]) =
!isEmpty && isInclusive && unum.equiv(x, end)
- protected def underlying = collection.immutable.Vector.empty[T]
+ protected def underlying = collection.immutable.IndexedSeq.empty[T]
/** Create a new range with the start and end values of this range and
* a new <code>step</code>.
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/IndexedSeq.scala
index dd9a2fefcc..e3a29dce9c 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/IndexedSeq.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id: Vector.scala 19072 2009-10-13 12:19:59Z rompf $
+// $Id: IndexedSeq.scala 19072 2009-10-13 12:19:59Z rompf $
// TODO: check overhead of builder factories for methods updated, +: and :+
@@ -20,50 +20,50 @@ import compat.Platform.arraycopy // FIXME: Platform.arraycopy is slower than Sys
import scala.collection.generic._
import scala.collection.mutable.Builder
-/** A subtrait of <code>collection.Vector</code> which represents sequences
+/** A subtrait of <code>collection.IndexedSeq</code> which represents sequences
* that cannot be mutated.
*
* @since 2.8
*/
-trait Vector[+A] extends Seq[A]
- with scala.collection.Vector[A]
- with GenericTraversableTemplate[A, Vector]
- with VectorLike[A, Vector[A]] {
- override def companion: GenericCompanion[Vector] = Vector
+trait IndexedSeq[+A] extends Seq[A]
+ with scala.collection.IndexedSeq[A]
+ with GenericTraversableTemplate[A, IndexedSeq]
+ with IndexedSeqLike[A, IndexedSeq[A]] {
+ override def companion: GenericCompanion[IndexedSeq] = IndexedSeq
}
/**
* @since 2.8
*/
-object Vector extends SeqFactory[Vector] {
- implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] =
+object IndexedSeq extends SeqFactory[IndexedSeq] {
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IndexedSeq[A]] =
new GenericCanBuildFrom[A] {
def apply() = newBuilder[A]
}
- override def empty[A] = NewVector.empty[A]
- def newBuilder[A]: Builder[A, Vector[A]] = NewVector.newBuilder[A]
+ override def empty[A] = NewIndexedSeq.empty[A]
+ def newBuilder[A]: Builder[A, IndexedSeq[A]] = NewIndexedSeq.newBuilder[A]
}
-// implementation classes below
+// implementation classes below (TODO: rename)
-trait NewVector[+A] extends Vector[A]
- with GenericTraversableTemplate[A, NewVector]
- with VectorLike[A, NewVector[A]]
- with SeqLike[A, NewVector[A]] { // use impl from SeqLike, not VectorLike
- override def companion: GenericCompanion[NewVector] = NewVector
+trait NewIndexedSeq[+A] extends IndexedSeq[A]
+ with GenericTraversableTemplate[A, NewIndexedSeq]
+ with IndexedSeqLike[A, NewIndexedSeq[A]]
+ with SeqLike[A, NewIndexedSeq[A]] { // use impl from SeqLike, not IndexedSeqLike
+ override def companion: GenericCompanion[NewIndexedSeq] = NewIndexedSeq
}
-object NewVector extends SeqFactory[NewVector] {
+object NewIndexedSeq extends SeqFactory[NewIndexedSeq] {
private[immutable] val bf = new GenericCanBuildFrom[Nothing] {
def apply() = newBuilder[Nothing]
}
- implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, NewVector[A]] =
- bf.asInstanceOf[CanBuildFrom[Coll, A, NewVector[A]]]
- def newBuilder[A]: Builder[A, NewVector[A]] = new NewVectorBuilder[A]
- override def empty[A]: NewVector[A] = new NewVectorImpl[A](0, 0, 0)
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, NewIndexedSeq[A]] =
+ bf.asInstanceOf[CanBuildFrom[Coll, A, NewIndexedSeq[A]]]
+ def newBuilder[A]: Builder[A, NewIndexedSeq[A]] = new NewIndexedSeqBuilder[A]
+ override def empty[A]: NewIndexedSeq[A] = new NewIndexedSeqImpl[A](0, 0, 0)
// TODO: special-case empty vectors and empty builders
}
@@ -73,20 +73,22 @@ object NewVector extends SeqFactory[NewVector] {
@serializable @SerialVersionUID(7129304555082767876L)
-private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) extends NewVector[A]
- with NewVectorPointer[A @uncheckedVariance] {
+private class NewIndexedSeqImpl[+A](startIndex: Int, endIndex: Int, focus: Int) extends NewIndexedSeq[A]
+ with NewIndexedSeqPointer[A @uncheckedVariance] {
//assert(startIndex >= 0, startIndex+"<0")
//assert(startIndex <= endIndex, startIndex+">"+endIndex)
//assert(focus >= 0, focus+"<0")
//assert(focus <= endIndex, focus+">"+endIndex)
+ var dirty = false
+
def length = endIndex - startIndex
- override def iterator: NewVectorIterator[A] = {
- val s = new NewVectorIterator[A](startIndex, endIndex)
+ override def iterator: NewIndexedSeqIterator[A] = {
+ val s = new NewIndexedSeqIterator[A](startIndex, endIndex)
s.initFrom(this)
- s.stabilize(focus)
+ if (dirty) s.stabilize(focus)
if (s.depth > 1) s.gotoPos(startIndex, startIndex ^ focus)
s
}
@@ -111,22 +113,22 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
// SeqLike api
- override def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[NewVector[A], B, That]): That = {
+ override def updated[B >: A, That](index: Int, elem: B)(implicit bf: CanBuildFrom[NewIndexedSeq[A], B, That]): That = {
// just ignore bf
updateAt(index, elem).asInstanceOf[That]
}
- override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[NewVector[A], B, That]): That = {
+ override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[NewIndexedSeq[A], B, That]): That = {
// just ignore bf
appendFront(elem).asInstanceOf[That]
}
- override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[NewVector[A], B, That]): That = {
+ override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[NewIndexedSeq[A], B, That]): That = {
// just ignore bf
appendBack(elem).asInstanceOf[That]
}
- override def take(n: Int): NewVector[A] = {
+ override def take(n: Int): NewIndexedSeq[A] = {
if (n < 0) throw new IllegalArgumentException(n.toString)
if (startIndex + n < endIndex) {
dropBack0(startIndex + n)
@@ -134,15 +136,15 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
this
}
- override def drop(n: Int): NewVector[A] = {
+ override def drop(n: Int): NewIndexedSeq[A] = {
if (n < 0) throw new IllegalArgumentException(n.toString)
if (startIndex + n < endIndex) {
dropFront0(startIndex + n)
} else
- NewVector.empty
+ NewIndexedSeq.empty
}
- override def takeRight(n: Int): NewVector[A] = {
+ override def takeRight(n: Int): NewIndexedSeq[A] = {
if (n < 0) throw new IllegalArgumentException(n.toString)
if (endIndex - n > startIndex) {
dropFront0(endIndex + n)
@@ -150,27 +152,28 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
this
}
- override def dropRight(n: Int): NewVector[A] = {
+ override def dropRight(n: Int): NewIndexedSeq[A] = {
if (n < 0) throw new IllegalArgumentException(n.toString)
if (endIndex - n > startIndex) {
dropBack0(endIndex - n)
} else
- NewVector.empty
+ NewIndexedSeq.empty
}
// semi-private api
- def updateAt[B >: A](index: Int, elem: B): NewVector[B] = {
+ def updateAt[B >: A](index: Int, elem: B): NewIndexedSeq[B] = {
val idx = checkRangeConvert(index)
- val s = new NewVectorImpl[B](startIndex, endIndex, idx)
+ val s = new NewIndexedSeqImpl[B](startIndex, endIndex, idx)
s.initFrom(this)
- s.gotoPosClean(focus, idx, focus ^ idx)
+ s.gotoPosClean(focus, idx, focus ^ idx) // if dirty commit changes; go to new pos and prepare for writing
s.display0(idx & 0x1f) = elem.asInstanceOf[AnyRef]
+ s.dirty = true
s
}
- def appendFront[B>:A](value: B): NewVector[B] = {
+ def appendFront[B>:A](value: B): NewIndexedSeq[B] = {
if (endIndex != startIndex) {
var blockIndex = (startIndex - 1) & ~31
var lo = (startIndex - 1) & 31
@@ -190,11 +193,11 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
if (depth > 1) {
val newBlockIndex = blockIndex + shift
val newFocus = focus + shift
- val s = new NewVectorImpl(startIndex - 1 + shift, endIndex + shift, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - 1 + shift, endIndex + shift, newBlockIndex)
s.initFrom(this)
s.shiftTopLevel(0, shiftBlocks) // shift right by n blocks
s.debug
- s.gotoFreshPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex)
+ s.gotoFreshPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex) // maybe create pos; prepare for writing
s.display0(lo) = value.asInstanceOf[AnyRef]
//assert(depth == s.depth)
s
@@ -205,10 +208,10 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
//assert(newBlockIndex == 0)
//assert(newFocus == 0)
- val s = new NewVectorImpl(startIndex - 1 + shift, endIndex + shift, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - 1 + shift, endIndex + shift, newBlockIndex)
s.initFrom(this)
s.shiftTopLevel(0, shiftBlocks) // shift right by n elements
- s.gotoPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex)
+ s.gotoPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex) // prepare for writing
s.display0(shift-1) = value.asInstanceOf[AnyRef]
s.debug
s
@@ -222,7 +225,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
val newFocus = focus + move
- val s = new NewVectorImpl(startIndex - 1 + move, endIndex + move, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - 1 + move, endIndex + move, newBlockIndex)
s.initFrom(this)
s.debug
s.gotoFreshPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex) // could optimize: we know it will create a whole branch
@@ -234,7 +237,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
val newBlockIndex = blockIndex
val newFocus = focus
- val s = new NewVectorImpl(startIndex - 1, endIndex, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - 1, endIndex, newBlockIndex)
s.initFrom(this)
s.gotoFreshPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex)
s.display0(lo) = value.asInstanceOf[AnyRef]
@@ -244,7 +247,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
} else {
// //println("will make writable block (from "+focus+") at: " + blockIndex)
- val s = new NewVectorImpl(startIndex - 1, endIndex, blockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - 1, endIndex, blockIndex)
s.initFrom(this)
s.gotoPosClean(focus, blockIndex, focus ^ blockIndex)
s.display0(lo) = value.asInstanceOf[AnyRef]
@@ -254,14 +257,14 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
// empty vector, just insert single element at the back
val elems = new Array[AnyRef](32)
elems(31) = value.asInstanceOf[AnyRef]
- val s = new NewVectorImpl(31,32,0)
+ val s = new NewIndexedSeqImpl(31,32,0)
s.depth = 1
s.display0 = elems
s
}
}
- def appendBack[B>:A](value: B): NewVector[B] = {
+ def appendBack[B>:A](value: B): NewIndexedSeq[B] = {
// //println("------- append " + value)
// debug()
if (endIndex != startIndex) {
@@ -280,7 +283,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
if (depth > 1) {
val newBlockIndex = blockIndex - shift
val newFocus = focus - shift
- val s = new NewVectorImpl(startIndex - shift, endIndex + 1 - shift, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - shift, endIndex + 1 - shift, newBlockIndex)
s.initFrom(this)
s.shiftTopLevel(shiftBlocks, 0) // shift left by n blocks
s.debug
@@ -296,7 +299,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
//assert(newBlockIndex == 0)
//assert(newFocus == 0)
- val s = new NewVectorImpl(startIndex - shift, endIndex + 1 - shift, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex - shift, endIndex + 1 - shift, newBlockIndex)
s.initFrom(this)
s.shiftTopLevel(shiftBlocks, 0) // shift right by n elements
s.gotoPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex)
@@ -308,7 +311,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
val newBlockIndex = blockIndex
val newFocus = focus
- val s = new NewVectorImpl(startIndex, endIndex + 1, newBlockIndex)
+ val s = new NewIndexedSeqImpl(startIndex, endIndex + 1, newBlockIndex)
s.initFrom(this)
s.gotoFreshPosClean(newFocus, newBlockIndex, newFocus ^ newBlockIndex)
s.display0(lo) = value.asInstanceOf[AnyRef]
@@ -321,7 +324,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
}
} else {
// //println("will make writable block (from "+focus+") at: " + blockIndex)
- val s = new NewVectorImpl(startIndex, endIndex + 1, blockIndex)
+ val s = new NewIndexedSeqImpl(startIndex, endIndex + 1, blockIndex)
s.initFrom(this)
s.gotoPosClean(focus, blockIndex, focus ^ blockIndex)
s.display0(lo) = value.asInstanceOf[AnyRef]
@@ -330,7 +333,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
} else {
val elems = new Array[AnyRef](32)
elems(0) = value.asInstanceOf[AnyRef]
- val s = new NewVectorImpl(0,1,0)
+ val s = new NewIndexedSeqImpl(0,1,0)
s.depth = 1
s.display0 = elems
s
@@ -461,7 +464,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
else throw new IllegalArgumentException()
}
- private def dropFront0(cutIndex: Int): NewVector[A] = {
+ private def dropFront0(cutIndex: Int): NewIndexedSeq[A] = {
var blockIndex = cutIndex & ~31
var lo = cutIndex & 31
@@ -471,7 +474,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
//println("cut front at " + cutIndex + ".." + endIndex + " (xor: "+xor+" shift: " + shift + " d: " + d +")")
- val s = new NewVectorImpl(cutIndex-shift, endIndex-shift, blockIndex-shift)
+ val s = new NewIndexedSeqImpl(cutIndex-shift, endIndex-shift, blockIndex-shift)
s.initFrom(this)
if (s.depth > 1)
s.gotoPos(blockIndex, focus ^ blockIndex)
@@ -481,7 +484,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
s
}
- private def dropBack0(cutIndex: Int): NewVector[A] = {
+ private def dropBack0(cutIndex: Int): NewIndexedSeq[A] = {
var blockIndex = (cutIndex - 1) & ~31
var lo = ((cutIndex - 1) & 31) + 1
@@ -490,7 +493,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
//println("cut back at " + startIndex + ".." + cutIndex + " (xor: "+xor+" d: " + d +")")
- val s = new NewVectorImpl(startIndex, cutIndex, blockIndex)
+ val s = new NewIndexedSeqImpl(startIndex, cutIndex, blockIndex)
s.initFrom(this)
if (s.depth > 1)
s.gotoPos(blockIndex, focus ^ blockIndex)
@@ -503,7 +506,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
}
-final class NewVectorIterator[+A](_startIndex: Int, _endIndex: Int) extends Iterator[A] with NewVectorPointer[A @uncheckedVariance] {
+final class NewIndexedSeqIterator[+A](_startIndex: Int, _endIndex: Int) extends Iterator[A] with NewIndexedSeqPointer[A @uncheckedVariance] {
private var blockIndex: Int = _startIndex & ~31
private var lo: Int = _startIndex & 31
@@ -542,7 +545,7 @@ final class NewVectorIterator[+A](_startIndex: Int, _endIndex: Int) extends Iter
}
-final class NewVectorBuilder[A]() extends Builder[A,NewVector[A]] with NewVectorPointer[A @uncheckedVariance] {
+final class NewIndexedSeqBuilder[A]() extends Builder[A,NewIndexedSeq[A]] with NewIndexedSeqPointer[A @uncheckedVariance] {
display0 = new Array[AnyRef](32)
depth = 1
@@ -562,8 +565,8 @@ final class NewVectorBuilder[A]() extends Builder[A,NewVector[A]] with NewVector
this
}
- def result: NewVector[A] = {
- val s = new NewVectorImpl[A](0, blockIndex + lo, 0) // TODO: should focus front or back?
+ def result: NewIndexedSeq[A] = {
+ val s = new NewIndexedSeqImpl[A](0, blockIndex + lo, 0) // TODO: should focus front or back?
s.initFrom(this)
if (depth > 1) s.gotoPos(0, blockIndex + lo)
s
@@ -579,7 +582,7 @@ final class NewVectorBuilder[A]() extends Builder[A,NewVector[A]] with NewVector
-trait NewVectorPointer[T] {
+trait NewIndexedSeqPointer[T] {
var depth: Int = _
var display0: Array[AnyRef] = _
var display1: Array[AnyRef] = _
@@ -589,7 +592,7 @@ trait NewVectorPointer[T] {
var display5: Array[AnyRef] = _
// used
- final def initFrom[U](that: NewVectorPointer[U]) = {
+ final def initFrom[U](that: NewIndexedSeqPointer[U]) = {
depth = that.depth
(depth - 1) match {
case 0 =>
@@ -646,6 +649,7 @@ trait NewVectorPointer[T] {
}
}
+ // unused currently
final def gotoZeroInit(elems: Array[AnyRef]) = (depth - 1) match { // goto pos zero
case 5 =>
display5 = elems.asInstanceOf[Array[AnyRef]]
@@ -783,7 +787,7 @@ trait NewVectorPointer[T] {
// USED IN APPEND
- // create a new block at the bottom level, and possible ex
+ // create a new block at the bottom level (and possibly nodes on its path)
final def gotoFreshPosClean(oldIndex: Int, newIndex: Int, xor: Int): Unit = { // goto block start pos
if (xor < (1 << 5)) { // level = 0
@@ -949,6 +953,9 @@ trait NewVectorPointer[T] {
}
}
+ // old path is maybe dirty (then we need to reconcile) <-- as a start, we could assume it always is (?)
+ // new path is being made dirty (we do need to change)
+
final def XgotoPosClean(oldIndex: Int, newIndex: Int, xor: Int): Unit = { // goto pos index
if (xor < (1 << 5)) { // level = 0
// //println("inside same chunk")
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index 79be24cb3e..de6da65f81 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -32,7 +32,7 @@ sealed abstract class List[+A] extends LinearSeq[A]
with LinearSeqLike[A, List[A]] {
override def companion: GenericCompanion[List] = List
- import scala.collection.{Iterable, Traversable, Seq, Vector}
+ import scala.collection.{Iterable, Traversable, Seq, IndexedSeq}
/** Returns true if the list does not contain any elements.
* @return <code>true</code>, iff the list is empty.
@@ -500,7 +500,7 @@ final case class ::[B](private var hd: B, private[scala] var tl: List[B]) extend
*/
object List extends SeqFactory[List] {
- import scala.collection.{Iterable, Seq, Vector}
+ import scala.collection.{Iterable, Seq, IndexedSeq}
implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, List[A]] =
new GenericCanBuildFrom[A] {
diff --git a/src/library/scala/collection/immutable/PagedSeq.scala b/src/library/scala/collection/immutable/PagedSeq.scala
index bac49c6934..72e09829d4 100644
--- a/src/library/scala/collection/immutable/PagedSeq.scala
+++ b/src/library/scala/collection/immutable/PagedSeq.scala
@@ -116,7 +116,7 @@ class PagedSeq[T: ClassManifest] protected(
first1: Page[T],
start: Int,
end: Int)
-extends scala.collection.Vector[T]
+extends scala.collection.IndexedSeq[T]
{
/** A paged sequence is constructed from a method that produces more characters when asked.
* The producer method is analogous to the read method in java.io.Reader.
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala
index 2b0b7200de..54a871decf 100644
--- a/src/library/scala/collection/immutable/Range.scala
+++ b/src/library/scala/collection/immutable/Range.scala
@@ -25,7 +25,7 @@ package scala.collection.immutable
* @version 2.8
* @since 2.5
*/
-class Range(val start: Int, val end: Int, val step: Int) extends Vector[Int] {
+class Range(val start: Int, val end: Int, val step: Int) extends IndexedSeq[Int] {
require(step != 0)
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 1d9adeab1c..903ec8446f 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -44,7 +44,7 @@ abstract class Stream[+A] extends LinearSeq[A]
self =>
override def companion: GenericCompanion[Stream] = Stream
- import scala.collection.{Traversable, Iterable, Seq, Vector}
+ import scala.collection.{Traversable, Iterable, Seq, IndexedSeq}
/** is this stream empty? */
def isEmpty: Boolean
@@ -414,7 +414,7 @@ object Stream extends SeqFactory[Stream] {
/** Creates a new builder for a stream */
def newBuilder[A]: Builder[A, Stream[A]] = new StreamBuilder[A]
- import scala.collection.{Iterable, Seq, Vector}
+ import scala.collection.{Iterable, Seq, IndexedSeq}
/** A builder for streams
* @note: This builder is lazy only in the sense that it does not go downs the spine
diff --git a/src/library/scala/collection/immutable/StringLike.scala b/src/library/scala/collection/immutable/StringLike.scala
index c1aa03a16c..e993a412fc 100644
--- a/src/library/scala/collection/immutable/StringLike.scala
+++ b/src/library/scala/collection/immutable/StringLike.scala
@@ -33,7 +33,7 @@ import StringLike._
/**
* @since 2.8
*/
-trait StringLike[+Repr] extends VectorLike[Char, Repr] with Ordered[String] {
+trait StringLike[+Repr] extends IndexedSeqLike[Char, Repr] with Ordered[String] {
self =>
/** Creates a string builder buffer as builder for this class */
diff --git a/src/library/scala/collection/immutable/WrappedString.scala b/src/library/scala/collection/immutable/WrappedString.scala
index a4dcfbe0a9..678ebf8cc4 100644
--- a/src/library/scala/collection/immutable/WrappedString.scala
+++ b/src/library/scala/collection/immutable/WrappedString.scala
@@ -19,7 +19,7 @@ import scala.util.matching.Regex
/**
* @since 2.8
*/
-class WrappedString(override val self: String) extends Vector[Char] with StringLike[WrappedString] with Proxy {
+class WrappedString(override val self: String) extends IndexedSeq[Char] with StringLike[WrappedString] with Proxy {
override protected[this] def thisCollection: WrappedString = this
override protected[this] def toCollection(repr: WrappedString): WrappedString = repr
diff --git a/src/library/scala/collection/interfaces/TraversableMethods.scala b/src/library/scala/collection/interfaces/TraversableMethods.scala
index b7801fea0f..25a1f6dc49 100644
--- a/src/library/scala/collection/interfaces/TraversableMethods.scala
+++ b/src/library/scala/collection/interfaces/TraversableMethods.scala
@@ -40,7 +40,7 @@ trait TraversableMethods[+A, +This <: TraversableLike[A, This] with Traversable[
def toSeq: Seq[A]
def toSet[B >: A]: immutable.Set[B]
def toStream: Stream[A]
- def toVector[B >: A]: mutable.Vector[B]
+ def toIndexedSeq[B >: A]: mutable.IndexedSeq[B]
// strings
def addString(b: StringBuilder): StringBuilder
diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala
index 3e865c069f..aabc696085 100644
--- a/src/library/scala/collection/mutable/ArrayBuffer.scala
+++ b/src/library/scala/collection/mutable/ArrayBuffer.scala
@@ -29,7 +29,7 @@ class ArrayBuffer[A](override protected val initialSize: Int)
extends Buffer[A]
with GenericTraversableTemplate[A, ArrayBuffer]
with BufferLike[A, ArrayBuffer[A]]
- with VectorLike[A, ArrayBuffer[A]]
+ with IndexedSeqLike[A, ArrayBuffer[A]]
with Builder[A, ArrayBuffer[A]]
with ResizableArray[A] {
@@ -69,7 +69,7 @@ class ArrayBuffer[A](override protected val initialSize: Int)
* @return the updated buffer.
*/
override def ++=(iter: Traversable[A]): this.type = iter match {
- case v: Vector[_] =>
+ case v: IndexedSeq[_] =>
val n = v.length
ensureSize(size0 + n)
v.copyToArray(array.asInstanceOf[scala.Array[Any]], size0, n)
diff --git a/src/library/scala/collection/mutable/ArrayLike.scala b/src/library/scala/collection/mutable/ArrayLike.scala
index fb9d53991c..b60c757070 100644
--- a/src/library/scala/collection/mutable/ArrayLike.scala
+++ b/src/library/scala/collection/mutable/ArrayLike.scala
@@ -13,23 +13,23 @@ package scala.collection
package mutable
import generic._
-/** A subtrait of collection.Vector which represents sequences
+/** A subtrait of collection.IndexedSeq which represents sequences
* that can be mutated.
*
* @since 2.8
*/
-trait ArrayLike[A, +Repr] extends VectorLike[A, Repr] { self =>
+trait ArrayLike[A, +Repr] extends IndexedSeqLike[A, Repr] { self =>
- /** Creates a possible nested vector which consists of all the elements
+ /** Creates a possible nested IndexedSeq which consists of all the elements
* of this array. If the elements are arrays themselves, the `deep' transformation
- * is applied recursively to them. The stringPrefix of the vector is
- * "Array", hence the vector prints like an array with all its
+ * is applied recursively to them. The stringPrefix of the IndexedSeq is
+ * "Array", hence the IndexedSeq prints like an array with all its
* elements shown, and the same recursively for any subarrays.
*
* Example: Array(Array(1, 2), Array(3, 4)).deep.toString
* prints: Array(Array(1, 2), Array(3, 4))
*/
- def deep: scala.collection.Vector[Any] = new scala.collection.Vector[Any] {
+ def deep: scala.collection.IndexedSeq[Any] = new scala.collection.IndexedSeq[Any] {
def length = self.length
def apply(idx: Int): Any = self.apply(idx) match {
case x: AnyRef if x.getClass.isArray => WrappedArray.make(x).deep
diff --git a/src/library/scala/collection/mutable/BufferLike.scala b/src/library/scala/collection/mutable/BufferLike.scala
index 7788989b1e..95b4c054cb 100644
--- a/src/library/scala/collection/mutable/BufferLike.scala
+++ b/src/library/scala/collection/mutable/BufferLike.scala
@@ -38,7 +38,7 @@ trait BufferLike[A, +This <: BufferLike[A, This] with Buffer[A]]
import scala.collection.{Iterable, Traversable}
-// Abstract methods from Vector:
+// Abstract methods from IndexedSeq:
/** Return element at index `n`
* @throws IndexOutofBoundsException if the index is not valid
diff --git a/src/library/scala/collection/mutable/GenericArray.scala b/src/library/scala/collection/mutable/GenericArray.scala
index fe016908bf..290309e664 100644
--- a/src/library/scala/collection/mutable/GenericArray.scala
+++ b/src/library/scala/collection/mutable/GenericArray.scala
@@ -23,9 +23,9 @@ import generic._
* @since 2.8
*/
class GenericArray[A](override val length: Int)
-extends Vector[A]
+extends IndexedSeq[A]
with GenericTraversableTemplate[A, GenericArray]
- with VectorLike[A, GenericArray[A]] {
+ with IndexedSeqLike[A, GenericArray[A]] {
override def companion: GenericCompanion[GenericArray] = GenericArray
diff --git a/src/library/scala/collection/mutable/Vector.scala b/src/library/scala/collection/mutable/IndexedSeq.scala
index dd70df3ca5..25382d4d5f 100644
--- a/src/library/scala/collection/mutable/Vector.scala
+++ b/src/library/scala/collection/mutable/IndexedSeq.scala
@@ -14,20 +14,20 @@ package mutable
import generic._
-/** A subtrait of <code>collection.Vector</code> which represents sequences
+/** A subtrait of <code>collection.IndexedSeq</code> which represents sequences
* that can be mutated.
*/
-trait Vector[A] extends Seq[A]
- with scala.collection.Vector[A]
- with GenericTraversableTemplate[A, Vector]
- with VectorLike[A, Vector[A]] {
- override def companion: GenericCompanion[Vector] = Vector
+trait IndexedSeq[A] extends Seq[A]
+ with scala.collection.IndexedSeq[A]
+ with GenericTraversableTemplate[A, IndexedSeq]
+ with IndexedSeqLike[A, IndexedSeq[A]] {
+ override def companion: GenericCompanion[IndexedSeq] = IndexedSeq
}
-object Vector extends SeqFactory[Vector] {
- implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, Vector[A]] =
+object IndexedSeq extends SeqFactory[IndexedSeq] {
+ implicit def canBuildFrom[A]: CanBuildFrom[Coll, A, IndexedSeq[A]] =
new GenericCanBuildFrom[A] {
def apply() = newBuilder[A]
}
- def newBuilder[A]: Builder[A, Vector[A]] = new ArrayBuffer
+ def newBuilder[A]: Builder[A, IndexedSeq[A]] = new ArrayBuffer[A]
}
diff --git a/src/library/scala/collection/mutable/VectorLike.scala b/src/library/scala/collection/mutable/IndexedSeqLike.scala
index 3f6a1868cd..74117e3707 100644
--- a/src/library/scala/collection/mutable/VectorLike.scala
+++ b/src/library/scala/collection/mutable/IndexedSeqLike.scala
@@ -13,21 +13,21 @@ package scala.collection
package mutable
import generic._
-/** A subtrait of scala.collection.Vector which represents sequences
+/** A subtrait of scala.collection.IndexedSeq which represents sequences
* that can be mutated.
*
* @since 2.8
*/
-trait VectorLike[A, +Repr] extends scala.collection.VectorLike[A, Repr] { self =>
+trait IndexedSeqLike[A, +Repr] extends scala.collection.IndexedSeqLike[A, Repr] { self =>
- override protected[this] def thisCollection: Vector[A] = this.asInstanceOf[Vector[A]]
- override protected[this] def toCollection(repr: Repr): Vector[A] = repr.asInstanceOf[Vector[A]]
+ override protected[this] def thisCollection: IndexedSeq[A] = this.asInstanceOf[IndexedSeq[A]]
+ override protected[this] def toCollection(repr: Repr): IndexedSeq[A] = repr.asInstanceOf[IndexedSeq[A]]
def update(idx: Int, elem: A)
/** Creates a view of this iterable @see Iterable.View
*/
- override def view = new VectorView[A, Repr] {
+ override def view = new IndexedSeqView[A, Repr] {
protected lazy val underlying = self.repr
override def iterator = self.iterator
override def length = self.length
diff --git a/src/library/scala/collection/mutable/VectorView.scala b/src/library/scala/collection/mutable/IndexedSeqView.scala
index 4a306c54c4..77b8862421 100644
--- a/src/library/scala/collection/mutable/VectorView.scala
+++ b/src/library/scala/collection/mutable/IndexedSeqView.scala
@@ -17,21 +17,21 @@ import Math.MAX_INT
import TraversableView.NoBuilder
-/** A non-strict view of a mutable vector.
- * This is a leaf class which mixes methods returning a plain vector view
- * and methods returning a mutable vector view.
+/** A non-strict view of a mutable IndexedSeq.
+ * This is a leaf class which mixes methods returning a plain IndexedSeq view
+ * and methods returning a mutable IndexedSeq view.
* There is no associated `Like' class.
* @author Sean McDirmid
* @author Martin Odersky
* @version 2.8
* @since 2.8
*/
-trait VectorView[A, +Coll] extends scala.collection.VectorView[A, Coll] {
+trait IndexedSeqView[A, +Coll] extends scala.collection.IndexedSeqView[A, Coll] {
self =>
def update(idx: Int, elem: A)
- trait Transformed[B] extends VectorView[B, Coll] with super.Transformed[B] {
+ trait Transformed[B] extends IndexedSeqView[B, Coll] with super.Transformed[B] {
def update(idx: Int, elem: B)
}
@@ -72,26 +72,26 @@ self =>
protected override def newTakenWhile(p: A => Boolean): Transformed[A] = new TakenWhile { val pred = p }
protected override def newReversed: Transformed[A] = new Reversed { }
- // Todo: if we replace VectorView[A, Coll] below by
- // private[this] type This = VectorView[A, Coll]
+ // Todo: if we replace IndexedSeqView[A, Coll] below by
+ // private[this] type This = IndexedSeqView[A, Coll]
// The interpreter will display resX.This.
// It shouldn't.
- override def filter(p: A => Boolean): VectorView[A, Coll] = newFiltered(p)
- override def init: VectorView[A, Coll] = newSliced(0, size - 1).asInstanceOf[VectorView[A, Coll]]
- override def drop(n: Int): VectorView[A, Coll] = newSliced(n max 0, MAX_INT).asInstanceOf[VectorView[A, Coll]]
- override def take(n: Int): VectorView[A, Coll] = newSliced(0, n).asInstanceOf[VectorView[A, Coll]]
- override def slice(from: Int, until: Int): VectorView[A, Coll] = newSliced(from max 0, until).asInstanceOf[VectorView[A, Coll]]
- override def dropWhile(p: A => Boolean): VectorView[A, Coll] = newDroppedWhile(p).asInstanceOf[VectorView[A, Coll]]
- override def takeWhile(p: A => Boolean): VectorView[A, Coll] = newTakenWhile(p).asInstanceOf[VectorView[A, Coll]]
- override def span(p: A => Boolean): (VectorView[A, Coll], VectorView[A, Coll]) = (takeWhile(p), dropWhile(p))
- override def splitAt(n: Int): (VectorView[A, Coll], VectorView[A, Coll]) = (take(n), drop(n))
- override def reverse: VectorView[A, Coll] = newReversed.asInstanceOf[VectorView[A, Coll]]
+ override def filter(p: A => Boolean): IndexedSeqView[A, Coll] = newFiltered(p)
+ override def init: IndexedSeqView[A, Coll] = newSliced(0, size - 1).asInstanceOf[IndexedSeqView[A, Coll]]
+ override def drop(n: Int): IndexedSeqView[A, Coll] = newSliced(n max 0, MAX_INT).asInstanceOf[IndexedSeqView[A, Coll]]
+ override def take(n: Int): IndexedSeqView[A, Coll] = newSliced(0, n).asInstanceOf[IndexedSeqView[A, Coll]]
+ override def slice(from: Int, until: Int): IndexedSeqView[A, Coll] = newSliced(from max 0, until).asInstanceOf[IndexedSeqView[A, Coll]]
+ override def dropWhile(p: A => Boolean): IndexedSeqView[A, Coll] = newDroppedWhile(p).asInstanceOf[IndexedSeqView[A, Coll]]
+ override def takeWhile(p: A => Boolean): IndexedSeqView[A, Coll] = newTakenWhile(p).asInstanceOf[IndexedSeqView[A, Coll]]
+ override def span(p: A => Boolean): (IndexedSeqView[A, Coll], IndexedSeqView[A, Coll]) = (takeWhile(p), dropWhile(p))
+ override def splitAt(n: Int): (IndexedSeqView[A, Coll], IndexedSeqView[A, Coll]) = (take(n), drop(n))
+ override def reverse: IndexedSeqView[A, Coll] = newReversed.asInstanceOf[IndexedSeqView[A, Coll]]
}
/*
- * object VectorView {
+ * object IndexedSeqView {
type Coll = TraversableView[_, C] forSome { type C <: scala.collection.Traversable[_] }
- implicit def canBuildFrom[A]: CanBuildFrom[Vector[_], A, VectorView[A], Coll] = new CanBuildFrom[mutable.Vector[_], A, VectorView[A], Coll] { : Coll) = new NoBuilder }
+ implicit def canBuildFrom[A]: CanBuildFrom[IndexedSeq[_], A, IndexedSeqView[A], Coll] = new CanBuildFrom[mutable.IndexedSeq[_], A, IndexedSeqView[A], Coll] { : Coll) = new NoBuilder }
}
*/
diff --git a/src/library/scala/collection/mutable/ResizableArray.scala b/src/library/scala/collection/mutable/ResizableArray.scala
index ec663d4887..32485d36c6 100644
--- a/src/library/scala/collection/mutable/ResizableArray.scala
+++ b/src/library/scala/collection/mutable/ResizableArray.scala
@@ -22,9 +22,9 @@ import generic._
* @version 2.8
* @since 1
*/
-trait ResizableArray[A] extends Vector[A]
+trait ResizableArray[A] extends IndexedSeq[A]
with GenericTraversableTemplate[A, ResizableArray]
- with VectorLike[A, ResizableArray[A]] {
+ with IndexedSeqLike[A, ResizableArray[A]] {
override def companion: GenericCompanion[ResizableArray] = ResizableArray
@@ -34,7 +34,7 @@ trait ResizableArray[A] extends Vector[A]
protected var size0: Int = 0
//##########################################################################
- // implement/override methods of Vector[A]
+ // implement/override methods of IndexedSeq[A]
/** Returns the length of this resizable array.
*/
diff --git a/src/library/scala/collection/mutable/StringBuilder.scala b/src/library/scala/collection/mutable/StringBuilder.scala
index 2f062b4b94..47bac8ad47 100644
--- a/src/library/scala/collection/mutable/StringBuilder.scala
+++ b/src/library/scala/collection/mutable/StringBuilder.scala
@@ -31,7 +31,7 @@ import scala.reflect.Manifest
@SerialVersionUID(0 - 8525408645367278351L)
final class StringBuilder(initCapacity: Int, private val initValue: String)
extends Builder[Char, String]
- with Vector[Char] {
+ with IndexedSeq[Char] {
require(initCapacity >= 0)
@@ -739,7 +739,7 @@ final class StringBuilder(initCapacity: Int, private val initValue: String)
* @return the index within this string of the first occurrence
* of the specified substring, starting at the specified index.
*/
- def indexOf(str: String, fromIndex: Int): Int = indexOfSeq(str.toVector, fromIndex)
+ def indexOf(str: String, fromIndex: Int): Int = indexOfSeq(str.toIndexedSeq, fromIndex)
/** <p>
* Returns the index within this string of the rightmost occurrence
@@ -780,7 +780,7 @@ final class StringBuilder(initCapacity: Int, private val initValue: String)
* @return the index within this sequence of the last occurrence
* of the specified substring.
*/
- def lastIndexOf(str: String, fromIndex: Int): Int = lastIndexOfSeq(str.toVector, fromIndex)
+ def lastIndexOf(str: String, fromIndex: Int): Int = lastIndexOfSeq(str.toIndexedSeq, fromIndex)
/** <p>
* Causes this character sequence to be replaced by the reverse of the
diff --git a/src/library/scala/collection/mutable/WrappedArray.scala b/src/library/scala/collection/mutable/WrappedArray.scala
index 4a3d84a303..957f1c56d4 100644
--- a/src/library/scala/collection/mutable/WrappedArray.scala
+++ b/src/library/scala/collection/mutable/WrappedArray.scala
@@ -23,7 +23,7 @@ import scala.collection.generic._
* @version 1.0
* @since 2.8
*/
-abstract class WrappedArray[T] extends Vector[T] with ArrayLike[T, WrappedArray[T]] {
+abstract class WrappedArray[T] extends IndexedSeq[T] with ArrayLike[T, WrappedArray[T]] {
override protected[this] def thisCollection: WrappedArray[T] = this
override protected[this] def toCollection(repr: WrappedArray[T]): WrappedArray[T] = repr
@@ -73,7 +73,7 @@ object WrappedArray {
ArrayBuilder.make[T]()(m) mapResult WrappedArray.make[T]
}
- def newBuilder[A]: Builder[A, Vector[A]] = new ArrayBuffer
+ def newBuilder[A]: Builder[A, IndexedSeq[A]] = new ArrayBuffer
@serializable
final class ofRef[T <: AnyRef](val array: Array[T]) extends WrappedArray[T] {
diff --git a/src/library/scala/package.scala b/src/library/scala/package.scala
index e18f0fd3bd..65f69a900d 100644
--- a/src/library/scala/package.scala
+++ b/src/library/scala/package.scala
@@ -20,8 +20,8 @@ package object scala {
type Seq[+A] = scala.collection.Seq[A]
val Seq = scala.collection.Seq
- type Vector[+A] = scala.collection.Vector[A]
- val Vector = scala.collection.Vector
+ type IndexedSeq[+A] = scala.collection.IndexedSeq[A]
+ val IndexedSeq = scala.collection.IndexedSeq
type Iterator[+A] = scala.collection.Iterator[A]
val Iterator = scala.collection.Iterator
@@ -52,6 +52,6 @@ package object scala {
@deprecated("use Seq instead") type Sequence[+A] = scala.collection.Seq[A]
@deprecated("use Seq instead") val Sequence = scala.collection.Seq
- @deprecated("use Vector instead") type RandomAccessSeq[+A] = scala.collection.Vector[A]
- @deprecated("use Vector instead") val RandomAccessSeq = scala.collection.Vector
+ @deprecated("use IndexedSeq instead") type RandomAccessSeq[+A] = scala.collection.IndexedSeq[A]
+ @deprecated("use IndexedSeq instead") val RandomAccessSeq = scala.collection.IndexedSeq
}
diff --git a/src/library/scala/runtime/BoxedArray.scala b/src/library/scala/runtime/BoxedArray.scala
index 7293cff319..2db7ee15dc 100644
--- a/src/library/scala/runtime/BoxedArray.scala
+++ b/src/library/scala/runtime/BoxedArray.scala
@@ -22,7 +22,7 @@ import collection.Seq
* @author Martin Odersky, Stephane Micheloud
* @version 1.0
*/
-abstract class BoxedArray[A] extends Vector[A] with VectorLike[A, BoxedArray[A]] with Boxed { self =>
+abstract class BoxedArray[A] extends IndexedSeq[A] with IndexedSeqLike[A, BoxedArray[A]] with Boxed { self =>
val ex = new Error("trying to create a BoxedArray")
ex.printStackTrace()
@@ -90,16 +90,16 @@ abstract class BoxedArray[A] extends Vector[A] with VectorLike[A, BoxedArray[A]]
override def copyToArray[B](xs: Array[B], start: Int, len: Int): Unit =
copyTo(0, xs, start, len)
- /** Creates a possible nested vector which consists of all the elements
+ /** Creates a possible nested IndexedSeq which consists of all the elements
* of this array. If the elements are arrays themselves, the `deep' transformation
- * is applied recursively to them. The stringPrefix of the vector is
- * "Array", hence the vector prints like an array with all its
+ * is applied recursively to them. The stringPrefix of the IndexedSeq is
+ * "Array", hence the IndexedSeq prints like an array with all its
* elements shown, and the same recursively for any subarrays.
*
* Example: Array(Array(1, 2), Array(3, 4)).deep.toString
* prints: Array(Array(1, 2), Array(3, 4))
*/
- def deep: collection.Vector[Any] = new collection.Vector[Any] {
+ def deep: collection.IndexedSeq[Any] = new collection.IndexedSeq[Any] {
def length = self.length
def apply(idx: Int): Any = self.apply(idx) match {
case elem: AnyRef if ScalaRunTime.isArray(elem) => ScalaRunTime.boxArray(elem).deep
diff --git a/src/library/scala/runtime/RichChar.scala b/src/library/scala/runtime/RichChar.scala
index 1f33c2681d..ba32491456 100644
--- a/src/library/scala/runtime/RichChar.scala
+++ b/src/library/scala/runtime/RichChar.scala
@@ -12,7 +12,7 @@
package scala.runtime
import java.lang.Character
-import collection.{Vector, VectorView}
+import collection.{IndexedSeq, IndexedSeqView}
import Predef.{require, NoSuchElementException}
/** <p>
@@ -85,11 +85,11 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] {
/** Create a <code>[Char]</code> over the characters from 'x' to 'y' - 1
*/
- def until(limit: Char): VectorView[Char, Vector[Char]] =
- if (limit <= x) Vector.empty.view
+ def until(limit: Char): IndexedSeqView[Char, IndexedSeq[Char]] =
+ if (limit <= x) IndexedSeq.empty.view
else
- new VectorView[Char, Vector[Char]] {
- protected def underlying = Vector.empty[Char]
+ new IndexedSeqView[Char, IndexedSeq[Char]] {
+ protected def underlying = IndexedSeq.empty[Char]
def length = limit - x
def apply(i: Int): Char = {
require(i >= 0 && i < length)
@@ -97,8 +97,8 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] {
}
}
- /** Create a <code>VectorView[Char]</code> over the characters from 'x' to 'y'
+ /** Create a <code>IndexedSeqView[Char]</code> over the characters from 'x' to 'y'
*/
- def to(y: Char): VectorView[Char, Vector[Char]] = until((y + 1).toChar)
+ def to(y: Char): IndexedSeqView[Char, IndexedSeq[Char]] = until((y + 1).toChar)
}
diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala
index 66d620f7bc..6998e889ca 100644
--- a/src/library/scala/runtime/RichString.scala
+++ b/src/library/scala/runtime/RichString.scala
@@ -13,8 +13,8 @@ package scala.runtime
import scala.util.matching.Regex
import collection.generic._
-import collection.VectorLike
-import collection.immutable.Vector
+import collection.IndexedSeqLike
+import collection.immutable.IndexedSeq
import collection.mutable.{Builder, StringBuilder}
object RichString {
@@ -40,7 +40,7 @@ object RichString {
import RichString._
-class RichString(val self: String) extends Proxy with Vector[Char] with VectorLike[Char, RichString] with PartialFunction[Int, Char] with Ordered[String] with Boxed {
+class RichString(val self: String) extends Proxy with IndexedSeq[Char] with IndexedSeqLike[Char, RichString] with PartialFunction[Int, Char] with Ordered[String] with Boxed {
/** Creates a string builder buffer as builder for this class */
override protected[this] def newBuilder = RichString.newBuilder
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index af28d09db7..aea7b159d1 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -191,7 +191,7 @@ object ScalaRunTime {
def stringOf(arg : Any): String = arg match {
case null => "null"
case arg: AnyRef if isArray(arg) =>
- val d: collection.Vector[Any] = WrappedArray.make(arg).deep
+ val d: collection.IndexedSeq[Any] = WrappedArray.make(arg).deep
d.toString
case arg: WrappedArray[_] => arg.deep.toString
case arg => arg.toString
diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala
index 0cf2490c81..2a0c65fc77 100644
--- a/src/library/scala/util/Random.scala
+++ b/src/library/scala/util/Random.scala
@@ -142,7 +142,7 @@ object Random extends Random
*/
// def shuffle: This = {
// import scala.util.Random.nextInt
- // val buf = thisCollection.toVector
+ // val buf = thisCollection.toIndexedSeq
//
// def swap(i1: Int, i2: Int) {
// val tmp = buf(i1)
diff --git a/src/library/scala/util/automata/WordBerrySethi.scala b/src/library/scala/util/automata/WordBerrySethi.scala
index 127dd34812..46c7dbcfe6 100644
--- a/src/library/scala/util/automata/WordBerrySethi.scala
+++ b/src/library/scala/util/automata/WordBerrySethi.scala
@@ -139,7 +139,7 @@ abstract class WordBerrySethi extends BaseBerrySethi {
this.pos = 0
// determine "Sethi-length" of the regexp
- //activeBinders = new Vector()
+ //activeBinders = new IndexedSeq()
var it = subexpr.iterator
while (it.hasNext)
traverse(it.next)
diff --git a/src/msil/ch/epfl/lamp/compiler/msil/tests/TableDump.java b/src/msil/ch/epfl/lamp/compiler/msil/tests/TableDump.java
index 0687af2f9f..1d3764dff2 100644
--- a/src/msil/ch/epfl/lamp/compiler/msil/tests/TableDump.java
+++ b/src/msil/ch/epfl/lamp/compiler/msil/tests/TableDump.java
@@ -40,7 +40,7 @@ public class TableDump extends PEFile {
out.println("#GUID stream"); GUID.dump(out); out.println();
out.println("#Blob stream"); Blob.dump(out); out.println();
- out.println("Heap Sizes Vector = 0x0" + Integer.toHexString(heapSizes));
+ out.println("Heap Sizes IndexedSeq = 0x0" + Integer.toHexString(heapSizes));
out.println();
for(int i = 0; i < Table.MAX_NUMBER; i++)
diff --git a/src/partest/scala/tools/partest/nest/Diff.java b/src/partest/scala/tools/partest/nest/Diff.java
index 754f9bb91b..abd09d0293 100644
--- a/src/partest/scala/tools/partest/nest/Diff.java
+++ b/src/partest/scala/tools/partest/nest/Diff.java
@@ -4,7 +4,7 @@ package scala.tools.partest.nest;
import java.util.Hashtable;
-/** A class to compare vectors of objects. The result of comparison
+/** A class to compare IndexedSeqs of objects. The result of comparison
is a list of <code>change</code> objects which form an
edit script. The objects compared are traditionally lines
of text from two files. Comparison options such as "ignore
@@ -68,12 +68,12 @@ public class Diff {
set of changes. This makes things slower, sometimes much slower. */
public boolean no_discards = false;
- private int[] xvec, yvec; /* Vectors being compared. */
- private int[] fdiag; /* Vector, indexed by diagonal, containing
+ private int[] xvec, yvec; /* IndexedSeqs being compared. */
+ private int[] fdiag; /* IndexedSeq, indexed by diagonal, containing
the X coordinate of the point furthest
along the given diagonal in the forward
search of the edit matrix. */
- private int[] bdiag; /* Vector, indexed by diagonal, containing
+ private int[] bdiag; /* IndexedSeq, indexed by diagonal, containing
the X coordinate of the point furthest
along the given diagonal in the backward
search of the edit matrix. */
@@ -275,7 +275,7 @@ public class Diff {
/** Compare in detail contiguous subsequences of the two files
which are known, as a whole, to match each other.
- The results are recorded in the vectors filevec[N].changed_flag, by
+ The results are recorded in the IndexedSeqs filevec[N].changed_flag, by
storing a 1 in the element for each line that is an insertion or deletion.
The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
@@ -538,7 +538,7 @@ public class Diff {
void clear() {
/* Allocate a flag for each line of each file, saying whether that line
is an insertion or deletion.
- Allocate an extra element, always zero, at each end of each vector.
+ Allocate an extra element, always zero, at each end of each IndexedSeq.
*/
changed_flag = new boolean[buffered_lines + 2];
}
@@ -849,16 +849,16 @@ public class Diff {
/** Number of elements (lines) in this file. */
final int buffered_lines;
- /** Vector, indexed by line number, containing an equivalence code for
- each line. It is this vector that is actually compared with that
+ /** IndexedSeq, indexed by line number, containing an equivalence code for
+ each line. It is this IndexedSeq that is actually compared with that
of another file to generate differences. */
private final int[] equivs;
- /** Vector, like the previous one except that
+ /** IndexedSeq, like the previous one except that
the elements for discarded lines have been squeezed out. */
final int[] undiscarded;
- /** Vector mapping virtual line numbers (not counting discarded lines)
+ /** IndexedSeq mapping virtual line numbers (not counting discarded lines)
to real ones (counting those lines). Both are origin-0. */
final int[] realindexes;
diff --git a/src/swing/scala/swing/BufferWrapper.scala b/src/swing/scala/swing/BufferWrapper.scala
index 19d219b06d..191e23242b 100644
--- a/src/swing/scala/swing/BufferWrapper.scala
+++ b/src/swing/scala/swing/BufferWrapper.scala
@@ -12,7 +12,7 @@
package scala.swing
import scala.collection.mutable.Buffer
-import scala.collection.Vector
+import scala.collection.IndexedSeq
/**
* Default partial implementation for buffer adapters.
@@ -32,7 +32,7 @@ protected[swing] abstract class BufferWrapper[A] extends Buffer[A] { outer =>
}
protected def insertAt(n: Int, a: A)
- override def readOnly: Vector[A] = new Vector[A] {
+ override def readOnly: IndexedSeq[A] = new IndexedSeq[A] {
def length = outer.length
def apply(idx : Int) = outer.apply(idx)
override def stringPrefix = outer.stringPrefix + "RO"
diff --git a/src/swing/scala/swing/Table.scala b/src/swing/scala/swing/Table.scala
index d31325863d..2cedbd1050 100644
--- a/src/swing/scala/swing/Table.scala
+++ b/src/swing/scala/swing/Table.scala
@@ -16,7 +16,7 @@ import javax.swing.table._
import javax.swing.event._
import java.awt.{Dimension, Color}
import event._
-import scala.collection.mutable.{Set, Vector}
+import scala.collection.mutable.{Set, IndexedSeq}
object Table {
object AutoResizeMode extends Enumeration {
@@ -122,7 +122,7 @@ class Table extends Component with Scrollable.Wrapper {
}
import Table._
- // TODO: use Vector[_ <: Vector[Any]], see ticket #2005
+ // TODO: use IndexedSeq[_ <: IndexedSeq[Any]], see ticket #2005
def this(rowData: Array[Array[Any]], columnNames: Seq[_]) = {
this()
peer.setModel(new AbstractTableModel {
diff --git a/test/files/run/sequenceComparisons.scala b/test/files/run/sequenceComparisons.scala
index cf1f64d67d..3ce08fb2e1 100644
--- a/test/files/run/sequenceComparisons.scala
+++ b/test/files/run/sequenceComparisons.scala
@@ -25,7 +25,7 @@ object Test {
// immutable.Stack(_: _*),
// mutable.Stack(_: _*),
immutable.Vector(_: _*),
- mutable.Vector(_: _*),
+ //mutable.Vector(_: _*),
immutable.List(_: _*),
immutable.Stream(_: _*)
)
diff --git a/test/files/run/viewtest.scala b/test/files/run/viewtest.scala
index 0f00536c1c..280ded57cf 100755
--- a/test/files/run/viewtest.scala
+++ b/test/files/run/viewtest.scala
@@ -13,7 +13,7 @@ object Test extends Application {
println(ys.force)
val zs = Array(1, 2, 3).view
- val as: VectorView[Int, Array[Int]] = zs map (_ + 1)
+ val as: IndexedSeqView[Int, Array[Int]] = zs map (_ + 1)
val bs: Array[Int] = as.force
val cs = zs.reverse
cs(0) += 1