summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTiark Rompf <tiark.rompf@epfl.ch>2009-10-21 21:05:40 +0000
committerTiark Rompf <tiark.rompf@epfl.ch>2009-10-21 21:05:40 +0000
commit4c84b0547757b861d27259c207aee1267b43ae01 (patch)
tree685cc007df2a00d2d5fe2c15723b5cabd158d3fe /src
parent49dde393b463709776f45316940f603bd5bb3ccf (diff)
downloadscala-4c84b0547757b861d27259c207aee1267b43ae01.tar.gz
scala-4c84b0547757b861d27259c207aee1267b43ae01.tar.bz2
scala-4c84b0547757b861d27259c207aee1267b43ae01.zip
added methods updated +: :+ to SeqLike
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/SeqLike.scala2
-rw-r--r--src/library/scala/collection/immutable/Vector.scala26
2 files changed, 20 insertions, 8 deletions
diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala
index 1a3151fd59..9f80386b2a 100644
--- a/src/library/scala/collection/SeqLike.scala
+++ b/src/library/scala/collection/SeqLike.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// $Id$
+// $Id: SeqLike.scala 18895 2009-10-02 17:57:16Z odersky $
package scala.collection
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index 40d82c5a71..61d6a783db 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -57,7 +57,6 @@ trait NewVector[+A] extends Vector[A]
object NewVector extends SeqFactory[NewVector] {
-<<<<<<< HEAD
private[immutable] val bf = new GenericCanBuildFrom[Nothing] {
def apply() = newBuilder[Nothing]
}
@@ -65,11 +64,6 @@ object NewVector extends SeqFactory[NewVector] {
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 builderFactory[A]: BuilderFactory[A, NewVector[A], Coll] =
- new VirtualBuilderFactory[A]
- def newBuilder[A]: Builder[A, NewVector[A]] = new NewVectorBuilder[A]
->>>>>>> scala.collection.Vector defaults to immutable
// TODO: special-case empty vectors and empty builders
}
@@ -117,17 +111,29 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
// SeqLike api
+<<<<<<< HEAD
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: BuilderFactory[B, That, NewVector[A]]): That = {
+>>>>>>> added methods updated +: :+ to SeqLike
// just ignore bf
updateAt(index, elem).asInstanceOf[That]
}
+<<<<<<< HEAD
override def +:[B >: A, That](elem: B)(implicit bf: CanBuildFrom[NewVector[A], B, That]): That = {
+=======
+ override def +:[B >: A, That](elem: B)(implicit bf: BuilderFactory[B, That, NewVector[A]]): That = {
+>>>>>>> added methods updated +: :+ to SeqLike
// just ignore bf
appendFront(elem).asInstanceOf[That]
}
+<<<<<<< HEAD
override def :+[B >: A, That](elem: B)(implicit bf: CanBuildFrom[NewVector[A], B, That]): That = {
+=======
+ override def :+[B >: A, That](elem: B)(implicit bf: BuilderFactory[B, That, NewVector[A]]): That = {
+>>>>>>> added methods updated +: :+ to SeqLike
// just ignore bf
appendBack(elem).asInstanceOf[That]
}
@@ -168,6 +174,7 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
// semi-private api
<<<<<<< HEAD
+<<<<<<< HEAD
def updateAt[B >: A](index: Int, elem: B): NewVector[B] = {
val idx = checkRangeConvert(index)
val s = new NewVectorImpl[B](startIndex, endIndex, idx)
@@ -324,6 +331,11 @@ private class NewVectorImpl[+A](startIndex: Int, endIndex: Int, focus: Int) exte
val s = new NewVectorImpl(startIndex, cutIndex, blockIndex)
>>>>>>> scala.collection.Vector defaults to immutable
+=======
+ def updateAt[B >: A](index: Int, elem: B): NewVector[B] = {
+ val idx = checkRangeConvert(index)
+ val s = new NewVectorImpl[B](startIndex, endIndex, idx)
+>>>>>>> added methods updated +: :+ to SeqLike
s.initFrom(this)
s.gotoPosClean(focus, idx, focus ^ idx)
s.display0(idx & 0x1f) = elem.asInstanceOf[AnyRef]
@@ -929,7 +941,7 @@ trait NewVectorPointer[T] {
final def copyOf(a: Array[AnyRef]) = {
// //println("copy")
val b = new Array[AnyRef](a.length)
- System.arraycopy(a, 0, b, 0, a.length)
+ arraycopy(a, 0, b, 0, a.length)
b
}