summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTiark Rompf <tiark.rompf@epfl.ch>2009-10-21 21:05:42 +0000
committerTiark Rompf <tiark.rompf@epfl.ch>2009-10-21 21:05:42 +0000
commitc570e1e7af9762a513f976e4fc5187a6a6efa271 (patch)
tree926ac032731545c16909029ece2650d2c2c498a1 /src
parent4c84b0547757b861d27259c207aee1267b43ae01 (diff)
downloadscala-c570e1e7af9762a513f976e4fc5187a6a6efa271.tar.gz
scala-c570e1e7af9762a513f976e4fc5187a6a6efa271.tar.bz2
scala-c570e1e7af9762a513f976e4fc5187a6a6efa271.zip
added methods updated +: :+ to SeqLike
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/immutable/Vector.scala172
1 files changed, 0 insertions, 172 deletions
diff --git a/src/library/scala/collection/immutable/Vector.scala b/src/library/scala/collection/immutable/Vector.scala
index 61d6a783db..dd9a2fefcc 100644
--- a/src/library/scala/collection/immutable/Vector.scala
+++ b/src/library/scala/collection/immutable/Vector.scala
@@ -111,29 +111,17 @@ 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]
}
@@ -173,169 +161,9 @@ 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)
-=======
- private def copyRange(array: Array[AnyRef], oldLeft: Int, newLeft: Int) = {
- val elems = new Array[AnyRef](32)
- System.arraycopy(array, oldLeft, elems, newLeft, 32 - Math.max(newLeft,oldLeft))
- elems
- }
-
- private def shiftTopLevel(oldLeft: Int, newLeft: Int) = (depth - 1) match {
- case 0 =>
- display0 = copyRange(display0, oldLeft, newLeft)
- case 1 =>
- display1 = copyRange(display1, oldLeft, newLeft)
- case 2 =>
- display2 = copyRange(display2, oldLeft, newLeft)
- case 3 =>
- display3 = copyRange(display3, oldLeft, newLeft)
- case 4 =>
- display4 = copyRange(display4, oldLeft, newLeft)
- case 5 =>
- display5 = copyRange(display5, oldLeft, newLeft)
- }
-
- private def cleanLeftEdge(cutIndex: Int) = (depth - 1) match {
- case 5 =>
- for (i <- 0 until ((cutIndex >>> 25) & 0x1f)) display5(i) = null
- for (i <- 0 until ((cutIndex >>> 20) & 0x1f)) display4(i) = null
- for (i <- 0 until ((cutIndex >>> 15) & 0x1f)) display3(i) = null
- for (i <- 0 until ((cutIndex >>> 10) & 0x1f)) display2(i) = null
- for (i <- 0 until ((cutIndex >>> 5) & 0x1f)) display1(i) = null
- for (i <- 0 until ((cutIndex >>> 0) & 0x1f)) display0(i) = null
- case 4 =>
- display5 = null
- for (i <- 0 until ((cutIndex >>> 20) & 0x1f)) display4(i) = null
- for (i <- 0 until ((cutIndex >>> 15) & 0x1f)) display3(i) = null
- for (i <- 0 until ((cutIndex >>> 10) & 0x1f)) display2(i) = null
- for (i <- 0 until ((cutIndex >>> 5) & 0x1f)) display1(i) = null
- for (i <- 0 until ((cutIndex >>> 0) & 0x1f)) display0(i) = null
- case 3 =>
- display5 = null
- display4 = null
- for (i <- 0 until ((cutIndex >>> 15) & 0x1f)) display3(i) = null
- for (i <- 0 until ((cutIndex >>> 10) & 0x1f)) display2(i) = null
- for (i <- 0 until ((cutIndex >>> 5) & 0x1f)) display1(i) = null
- for (i <- 0 until ((cutIndex >>> 0) & 0x1f)) display0(i) = null
- case 2 =>
- display5 = null
- display4 = null
- display3 = null
- for (i <- 0 until ((cutIndex >>> 10) & 0x1f)) display2(i) = null
- for (i <- 0 until ((cutIndex >>> 5) & 0x1f)) display1(i) = null
- for (i <- 0 until ((cutIndex >>> 0) & 0x1f)) display0(i) = null
- case 1 =>
- display5 = null
- display4 = null
- display3 = null
- display2 = null
- for (i <- 0 until ((cutIndex >>> 5) & 0x1f)) display1(i) = null
- for (i <- 0 until ((cutIndex >>> 0) & 0x1f)) display0(i) = null
- case 0 =>
- display5 = null
- display4 = null
- display3 = null
- display2 = null
- display1 = null
- for (i <- 0 until ((cutIndex >>> 0) & 0x1f)) display0(i) = null
- }
-
- private def cleanRightEdge(cutIndex: Int) = (depth - 1) match {
- case 5 =>
- for (i <- ((cutIndex >>> 25) & 0x1f) until 32) display5(i) = null
- for (i <- ((cutIndex >>> 20) & 0x1f) until 32) display4(i) = null
- for (i <- ((cutIndex >>> 15) & 0x1f) until 32) display3(i) = null
- for (i <- ((cutIndex >>> 10) & 0x1f) until 32) display2(i) = null
- for (i <- ((cutIndex >>> 5) & 0x1f) until 32) display1(i) = null
- for (i <- ((cutIndex >>> 0) & 0x1f) until 32) display0(i) = null
- case 4 =>
- display5 = null
- for (i <- ((cutIndex >>> 20) & 0x1f) until 32) display4(i) = null
- for (i <- ((cutIndex >>> 15) & 0x1f) until 32) display3(i) = null
- for (i <- ((cutIndex >>> 10) & 0x1f) until 32) display2(i) = null
- for (i <- ((cutIndex >>> 5) & 0x1f) until 32) display1(i) = null
- for (i <- ((cutIndex >>> 0) & 0x1f) until 32) display0(i) = null
- case 3 =>
- display5 = null
- display4 = null
- for (i <- ((cutIndex >>> 15) & 0x1f) until 32) display3(i) = null
- for (i <- ((cutIndex >>> 10) & 0x1f) until 32) display2(i) = null
- for (i <- ((cutIndex >>> 5) & 0x1f) until 32) display1(i) = null
- for (i <- ((cutIndex >>> 0) & 0x1f) until 32) display0(i) = null
- case 2 =>
- display5 = null
- display4 = null
- display3 = null
- for (i <- ((cutIndex >>> 10) & 0x1f) until 32) display2(i) = null
- for (i <- ((cutIndex >>> 5) & 0x1f) until 32) display1(i) = null
- for (i <- ((cutIndex >>> 0) & 0x1f) until 32) display0(i) = null
- case 1 =>
- display5 = null
- display4 = null
- display3 = null
- display2 = null
- for (i <- ((cutIndex >>> 5) & 0x1f) until 32) display1(i) = null
- for (i <- ((cutIndex >>> 0) & 0x1f) until 32) display0(i) = null
- case 0 =>
- display5 = null
- display4 = null
- display3 = null
- display2 = null
- display1 = null
- for (i <- ((cutIndex >>> 0) & 0x1f) until 32) display0(i) = null
- }
-
- private def requiredDepth(xor: Int) = {
- if (xor < (1 << 5)) 1
- else if (xor < (1 << 10)) 2
- else if (xor < (1 << 15)) 3
- else if (xor < (1 << 20)) 4
- else if (xor < (1 << 25)) 5
- else if (xor < (1 << 30)) 6
- else throw new IllegalArgumentException()
- }
-
- private def dropFront0(cutIndex: Int): NewVector[A] = {
- var blockIndex = cutIndex & ~31
- var lo = cutIndex & 31
-
- val xor = cutIndex ^ (endIndex - 1)
- val d = requiredDepth(xor)
- val shift = (cutIndex & ~((1 << (5*d))-1))
-
- //println("cut front at " + cutIndex + ".." + endIndex + " (xor: "+xor+" shift: " + shift + " d: " + d +")")
-
- val s = new NewVectorImpl(cutIndex-shift, endIndex-shift, blockIndex-shift)
- s.initFrom(this)
- if (s.depth > 1)
- s.gotoPos(blockIndex, focus ^ blockIndex)
- s.depth = d
- s.stabilize(blockIndex-shift)
- s.cleanLeftEdge(cutIndex-shift)
- s
- }
-
- private def dropBack0(cutIndex: Int): NewVector[A] = {
- var blockIndex = (cutIndex - 1) & ~31
- var lo = ((cutIndex - 1) & 31) + 1
-
- val xor = startIndex ^ (cutIndex - 1)
- val d = requiredDepth(xor)
-
- //println("cut back at " + startIndex + ".." + cutIndex + " (xor: "+xor+" d: " + d +")")
-
- 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]