summaryrefslogtreecommitdiff
path: root/src/library/scalax/runtime
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2009-05-08 16:33:15 +0000
committerMartin Odersky <odersky@gmail.com>2009-05-08 16:33:15 +0000
commit14a631a5fec42d04d0723355a0b93e482b5e4662 (patch)
treef639c2a22e89e193b9abea391993ecfd4d5326ee /src/library/scalax/runtime
parent2379eb4ebbd28c8892b50a1d9fa8a687099eea4d (diff)
downloadscala-14a631a5fec42d04d0723355a0b93e482b5e4662.tar.gz
scala-14a631a5fec42d04d0723355a0b93e482b5e4662.tar.bz2
scala-14a631a5fec42d04d0723355a0b93e482b5e4662.zip
massive new collections checkin.
Diffstat (limited to 'src/library/scalax/runtime')
-rw-r--r--src/library/scalax/runtime/Boxed.scala18
-rwxr-xr-xsrc/library/scalax/runtime/BoxedAnyArray.scala239
-rwxr-xr-xsrc/library/scalax/runtime/BoxedArray.scala138
-rwxr-xr-xsrc/library/scalax/runtime/BoxedBooleanArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedByteArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedCharArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedDoubleArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedFloatArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedIntArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedLongArray.scala25
-rwxr-xr-xsrc/library/scalax/runtime/BoxedShortArray.scala25
-rw-r--r--src/library/scalax/runtime/BoxedString.scala195
-rwxr-xr-xsrc/library/scalax/runtime/ScalaRunTime.scala152
-rw-r--r--src/library/scalax/runtime/StringVector.scala54
14 files changed, 0 insertions, 996 deletions
diff --git a/src/library/scalax/runtime/Boxed.scala b/src/library/scalax/runtime/Boxed.scala
deleted file mode 100644
index 241b12e485..0000000000
--- a/src/library/scalax/runtime/Boxed.scala
+++ /dev/null
@@ -1,18 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: Buffer.scala 15799 2008-08-15 18:23:54Z odersky $
-
-
-package scalax.runtime
-
-trait Boxed {
-
-}
-
-
diff --git a/src/library/scalax/runtime/BoxedAnyArray.scala b/src/library/scalax/runtime/BoxedAnyArray.scala
deleted file mode 100755
index 6e14cafdfc..0000000000
--- a/src/library/scalax/runtime/BoxedAnyArray.scala
+++ /dev/null
@@ -1,239 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedAnyArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-import compat.Platform
-
-/**
- * Arrays created by <code>new Array[T](length)</code> where <code>T</code>
- * is a type variable.
- *
- * @author Martin Odersky
- */
-@serializable
-final class BoxedAnyArray[A](val length: Int) extends BoxedArray[A] {
-
- private var boxed = new Array[AnyRef](length)
- private val hash = boxed.hashCode()
- private var unboxed: AnyRef = null
- private var elemClass: Class[_] = null
-
- def apply(index: Int): A = synchronized {
- if (unboxed eq null)
- boxed(index)
- else if (elemClass eq classOf[Int])
- Int.box(unboxed.asInstanceOf[Array[Int]](index))
- else if (elemClass eq classOf[Double])
- Double.box(unboxed.asInstanceOf[Array[Double]](index))
- else if (elemClass eq classOf[Float])
- Float.box(unboxed.asInstanceOf[Array[Float]](index))
- else if (elemClass eq classOf[Long])
- Long.box(unboxed.asInstanceOf[Array[Long]](index))
- else if (elemClass eq classOf[Char])
- Char.box(unboxed.asInstanceOf[Array[Char]](index))
- else if (elemClass eq classOf[Byte])
- Byte.box(unboxed.asInstanceOf[Array[Byte]](index))
- else if (elemClass eq classOf[Short])
- Short.box(unboxed.asInstanceOf[Array[Short]](index))
- else if (elemClass eq classOf[Boolean])
- Boolean.box(unboxed.asInstanceOf[Array[Boolean]](index))
- else
- unboxed.asInstanceOf[Array[AnyRef]](index)
- }.asInstanceOf[A]
-
- def update(index: Int, _elem: A): Unit = synchronized {
- val elem = _elem.asInstanceOf[AnyRef]
- if (unboxed eq null)
- boxed(index) = elem
- else if (elemClass eq classOf[Int])
- unboxed.asInstanceOf[Array[Int]](index) = Int.unbox(elem)
- else if (elemClass eq classOf[Double])
- unboxed.asInstanceOf[Array[Double]](index) = Double.unbox(elem)
- else if (elemClass eq classOf[Float])
- unboxed.asInstanceOf[Array[Float]](index) = Float.unbox(elem)
- else if (elemClass eq classOf[Long])
- unboxed.asInstanceOf[Array[Long]](index) = Long.unbox(elem)
- else if (elemClass eq classOf[Char])
- unboxed.asInstanceOf[Array[Char]](index) = Char.unbox(elem)
- else if (elemClass eq classOf[Byte])
- unboxed.asInstanceOf[Array[Byte]](index) = Byte.unbox(elem)
- else if (elemClass eq classOf[Short])
- unboxed.asInstanceOf[Array[Short]](index) = Short.unbox(elem)
- else if (elemClass eq classOf[Boolean])
- unboxed.asInstanceOf[Array[Boolean]](index) = Boolean.unbox(elem)
- else
- unboxed.asInstanceOf[Array[AnyRef]](index) = elem
- }
-
- def unbox(elemClass: Class[_]): AnyRef = synchronized {
- if (unboxed eq null) {
- this.elemClass = elemClass;
- if (elemClass eq classOf[Int]) {
- val newvalue = new Array[Int](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Int.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue
- } else if (elemClass eq classOf[Double]) {
- val newvalue = new Array[Double](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Double.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue;
- } else if (elemClass eq classOf[Float]) {
- val newvalue = new Array[Float](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Float.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue;
- } else if (elemClass eq classOf[Long]) {
- val newvalue = new Array[Long](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Long.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue;
- } else if (elemClass eq classOf[Char]) {
- val newvalue = new Array[Char](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Char.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue
- } else if (elemClass eq classOf[Byte]) {
- val newvalue = new Array[Byte](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Byte.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue;
- } else if (elemClass eq classOf[Short]) {
- val newvalue = new Array[Short](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Short.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue;
- } else if (elemClass eq classOf[Boolean]) {
- val newvalue = new Array[Boolean](length)
- var i = 0
- while (i < length) {
- newvalue(i) = Boolean.unbox(boxed(i))
- i += 1
- }
- unboxed = newvalue;
- } else if (elemClass == classOf[AnyRef]) {
- unboxed = boxed
- } else {
- unboxed = Platform.createArray(elemClass, length)
- if (elemClass.isArray) {
- var i = 0
- while (i < length) {
- boxed(i) match {
- case ba: BoxedArray[_] => boxed(i) = ba.unbox(elemClass.getComponentType())
- case _ =>
- }
- i += 1
- }
- }
- Platform.arraycopy(boxed, 0, unboxed, 0, length)
- }
- boxed = null
- }
- unboxed
- }
-
- override def equals(other: Any): Boolean =
- other.isInstanceOf[BoxedAnyArray[_]] && (this eq (other.asInstanceOf[BoxedAnyArray[_]])) ||
- (if (unboxed eq null) boxed == other else unboxed == other)
-
- override def hashCode(): Int = hash
-
- def value: AnyRef = {
- if (unboxed eq null) throw new NotDefinedError("BoxedAnyArray.value")
- unboxed
- }
-
- private def adapt(other: AnyRef): AnyRef =
- if (this.unboxed eq null)
- other match {
- case that: BoxedAnyArray[_] =>
- if (that.unboxed eq null) {
- that.boxed
- } else {
- if (ScalaRunTime.isValueClass(that.elemClass)) unbox(that.elemClass);
- that.unboxed
- }
- case that: BoxedArray[_] =>
- adapt(that.value)
- case that: Array[Int] =>
- unbox(classOf[Int]); that
- case that: Array[Double] =>
- unbox(classOf[Double]); that
- case that: Array[Float] =>
- unbox(classOf[Float]); that
- case that: Array[Long] =>
- unbox(classOf[Long]); that
- case that: Array[Char] =>
- unbox(classOf[Char]); that
- case that: Array[Short] =>
- unbox(classOf[Short]); that
- case that: Array[Byte] =>
- unbox(classOf[Byte]); that
- case that: Array[Boolean] =>
- unbox(classOf[Boolean]); that
- case _ =>
- other
- }
- else
- other match {
- case that: BoxedAnyArray[_] =>
- if (that.unboxed ne null) that.unboxed
- else if (ScalaRunTime.isValueClass(this.elemClass)) that.unbox(this.elemClass)
- else that.boxed
- case that: BoxedArray[_] =>
- adapt(that.value)
- case _ =>
- other
- }
-
- override def copyFrom(src: AnyRef, from: Int, to: Int, len: Int) {
- val src1 = adapt(src)
- Array.copy(src1, from, if (unboxed ne null) unboxed else boxed, to, len)
- }
-
- override def copyTo(from: Int, dest: AnyRef, to: Int, len: Int) {
- var dest1 = adapt(dest)
- Array.copy(if (unboxed ne null) unboxed else boxed, from, dest1, to, len)
- }
-
- final override def filter(p: A => Boolean): BoxedArray[A] = {
- val (len, include) = countAndMemo(p)
- val result = new BoxedAnyArray[A](len)
- var i, j = 0
- while (j < len) {
- if (include(i)) { result(j) = this(i); j += 1 }
- i += 1
- }
- result
- }
-}
diff --git a/src/library/scalax/runtime/BoxedArray.scala b/src/library/scalax/runtime/BoxedArray.scala
deleted file mode 100755
index 47bb3a0d64..0000000000
--- a/src/library/scalax/runtime/BoxedArray.scala
+++ /dev/null
@@ -1,138 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-import Predef._
-import collection.mutable.{Vector, ArrayBuffer}
-import collection.generic._
-
-/**
- * <p>A class representing <code>Array[T]</code></p>
- *
- * @author Martin Odersky, Stephane Micheloud
- * @version 1.0
- */
-abstract class BoxedArray[A] extends Vector[A] with MutableVectorTemplate[BoxedArray, A] with Boxed {
-
- /** The length of the array */
- def length: Int
-
- /** The element at given index */
- def apply(index: Int): A
-
- /** Update element at given index */
- def update(index: Int, elem: A): Unit
-
- /** Creates new builder for this collection ==> move to subclasses
- *
- * */
- def newBuilder[B] = new ArrayBuffer[B].mapResult[BoxedArray] { // !!! Adriaan: can't drop [BoxedArray] here
- _.toArray.asInstanceOf[BoxedArray[B]]
- }
-
- /** Convert to Java array.
- * @param elemTag Either one of the tags ".N" where N is the name of a primitive type
- * (@see ScalaRunTime), or a full class name.
- */
- def unbox(elemClass: Class[_]): AnyRef
-
- /** The underlying array value
- */
- def value: AnyRef
-
- def copyFrom(src: AnyRef, from: Int, to: Int, len: Int): Unit =
- Array.copy(src, from, value, to, len)
-
- def copyTo(from: Int, dest: AnyRef, to: Int, len: Int): Unit = {
- Array.copy(value, from, dest, to, len)
- }
-
- override def equals(other: Any) =
- (value == other) ||
- other.isInstanceOf[BoxedArray[_]] && (value == other.asInstanceOf[BoxedArray[_]].value)
-
- override def hashCode(): Int = value.hashCode()
-
- /** Fills the given array <code>xs</code> with the elements of
- * this sequence starting at position <code>start</code>.
- *
- * @param xs the array to fill.
- * @param start starting index.
- * @pre the array must be large enough to hold all elements.
- */
- override def copyToArray[B](xs: Array[B], start: Int, len: Int): Unit =
- copyTo(0, xs, start, len)
-
- final def deepToString() = deepMkString(stringPrefix + "(", ", ", ")")
-
- final def deepMkString(start: String, sep: String, end: String): String = {
- def _deepToString(x: Any) = x match {
- case a: AnyRef if ScalaRunTime.isArray(a) =>
- ScalaRunTime.boxArray(a).deepMkString(start, sep, end)
- case _ =>
- ScalaRunTime.stringOf(x)
- }
- val buf = new StringBuilder()
- buf.append(start)
- val elems = elements
- if (elems.hasNext) buf.append(_deepToString(elems.next))
- while (elems.hasNext) {
- buf.append(sep); buf.append(_deepToString(elems.next))
- }
- buf.append(end)
- buf.toString
- }
-
- final def deepMkString(sep: String): String = this.deepMkString("", sep, "")
-
- final def deepEquals(that: Any): Boolean = {
- def _deepEquals(x1: Any, x2: Any) = (x1, x2) match {
- case (a1: BoxedArray[_], a2: BoxedArray[_]) =>
- _sameElements(a1, a2)
- case (a1: AnyRef, a2: AnyRef)
- if ScalaRunTime.isArray(a1) && ScalaRunTime.isArray(a2) =>
- _sameElements(ScalaRunTime.boxArray(a1), ScalaRunTime.boxArray(a2))
- case _ =>
- x1.equals(x2)
- }
- def _sameElements(a1: BoxedArray[_], a2: BoxedArray[_]): Boolean = {
- val it1 = a1.elements
- val it2 = a2.elements
- var res = true
- while (res && it1.hasNext && it2.hasNext)
- res = _deepEquals(it1.next, it2.next)
- !it1.hasNext && !it2.hasNext && res
- }
- that match {
- case a: BoxedArray[_] =>
- _sameElements(this, a)
- case a: AnyRef if ScalaRunTime.isArray(a) =>
- _sameElements(this, ScalaRunTime.boxArray(a))
- case _ =>
- false
- }
- }
-
- override final def stringPrefix: String = "Array"
-
- protected def countAndMemo(p: A => Boolean): (Int, Array[Boolean]) = {
- val len = length
- val memo = new Array[Boolean](len)
- var count = 0
- var i = 0
- while (i < len) {
- if (p(this(i))) { memo(i) = true; count += 1 }
- i += 1
- }
- (count, memo)
- }
-}
diff --git a/src/library/scalax/runtime/BoxedBooleanArray.scala b/src/library/scalax/runtime/BoxedBooleanArray.scala
deleted file mode 100755
index 1dc136a50f..0000000000
--- a/src/library/scalax/runtime/BoxedBooleanArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedBooleanArray(val value: Array[Boolean]) extends BoxedArray[Boolean] {
-
- def length: Int = value.length
-
- def apply(index: Int): Boolean = value(index)
-
- def update(index: Int, elem: Boolean) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedByteArray.scala b/src/library/scalax/runtime/BoxedByteArray.scala
deleted file mode 100755
index f42dbdda38..0000000000
--- a/src/library/scalax/runtime/BoxedByteArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedByteArray(val value: Array[Byte]) extends BoxedArray[Byte] {
-
- def length: Int = value.length
-
- def apply(index: Int): Byte = value(index)
-
- def update(index: Int, elem: Byte) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedCharArray.scala b/src/library/scalax/runtime/BoxedCharArray.scala
deleted file mode 100755
index c6f19d26e0..0000000000
--- a/src/library/scalax/runtime/BoxedCharArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedCharArray(val value: Array[Char]) extends BoxedArray[Char] {
-
- def length: Int = value.length
-
- def apply(index: Int): Char = value(index)
-
- def update(index: Int, elem: Char) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedDoubleArray.scala b/src/library/scalax/runtime/BoxedDoubleArray.scala
deleted file mode 100755
index 16fc3e1056..0000000000
--- a/src/library/scalax/runtime/BoxedDoubleArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedDoubleArray(val value: Array[Double]) extends BoxedArray[Double] {
-
- def length: Int = value.length
-
- def apply(index: Int): Double = value(index)
-
- def update(index: Int, elem: Double) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedFloatArray.scala b/src/library/scalax/runtime/BoxedFloatArray.scala
deleted file mode 100755
index d10f16f6f6..0000000000
--- a/src/library/scalax/runtime/BoxedFloatArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedFloatArray(val value: Array[Float]) extends BoxedArray[Float] {
-
- def length: Int = value.length
-
- def apply(index: Int): Float = value(index)
-
- def update(index: Int, elem: Float) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedIntArray.scala b/src/library/scalax/runtime/BoxedIntArray.scala
deleted file mode 100755
index 78a033190a..0000000000
--- a/src/library/scalax/runtime/BoxedIntArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedIntArray(val value: Array[Int]) extends BoxedArray[Int] {
-
- def length: Int = value.length
-
- def apply(index: Int): Int = value(index)
-
- def update(index: Int, elem: Int) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedLongArray.scala b/src/library/scalax/runtime/BoxedLongArray.scala
deleted file mode 100755
index 86816d6638..0000000000
--- a/src/library/scalax/runtime/BoxedLongArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedLongArray(val value: Array[Long]) extends BoxedArray[Long] {
-
- def length: Int = value.length
-
- def apply(index: Int): Long = value(index)
-
- def update(index: Int, elem: Long) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedShortArray.scala b/src/library/scalax/runtime/BoxedShortArray.scala
deleted file mode 100755
index 6d5c82e7ba..0000000000
--- a/src/library/scalax/runtime/BoxedShortArray.scala
+++ /dev/null
@@ -1,25 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: BoxedByteArray.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-@serializable
-final class BoxedShortArray(val value: Array[Short]) extends BoxedArray[Short] {
-
- def length: Int = value.length
-
- def apply(index: Int): Short = value(index)
-
- def update(index: Int, elem: Short) {
- value(index) = elem
- }
- def unbox(elemClass: Class[_]): AnyRef = value
-}
diff --git a/src/library/scalax/runtime/BoxedString.scala b/src/library/scalax/runtime/BoxedString.scala
deleted file mode 100644
index ef5a8b43c7..0000000000
--- a/src/library/scalax/runtime/BoxedString.scala
+++ /dev/null
@@ -1,195 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: RichString.scala 15602 2008-07-24 08:20:38Z washburn $
-
-
-package scalax.runtime
-
-import scala.util.matching.Regex
-import scalax.collection._
-import scalax.collection.mutable.StringBuilder
-import scalax.collection.generic
-import scalax.collection.generic._
-
-object BoxedString {
- // just statics for rich string.
- private final val LF: Char = 0x0A
- private final val FF: Char = 0x0C
- private final val CR: Char = 0x0D
- private final val SU: Char = 0x1A
-}
-
-import BoxedString._
-
-class BoxedString(val self: String) extends StringVector[Char] with Proxy with PartialFunction[Int, Char] with Ordered[String] {
-
- /** Return element at index `n`
- * @throws IndexOutofBoundsException if the index is not valid
- */
- def apply(n: Int): Char = self charAt n
-
- def length = self.length
-
- override def unbox = self
- override def mkString = self
- override def toString = self
-
- /** return n times the current string
- */
- def * (n: Int): String = {
- val buf = new StringBuilder
- for (i <- 0 until n) buf append self
- buf.toString
- }
-
- override def compare(other: String) = self compareTo other
-
- private def isLineBreak(c: Char) = c == LF || c == FF
-
- /** <p>
- * Strip trailing line end character from this string if it has one.
- * A line end character is one of
- * </p>
- * <ul style="list-style-type: none;">
- * <li>LF - line feed (0x0A hex)</li>
- * <li>FF - form feed (0x0C hex)</li>
- * </ul>
- * <p>
- * If a line feed character LF is preceded by a carriage return CR
- * (0x0D hex), the CR character is also stripped (Windows convention).
- * </p>
- */
- def stripLineEnd: String = {
- val len = self.length
- if (len == 0) self
- else {
- val last = apply(len - 1)
- if (isLineBreak(last))
- self.substring(0, if (last == LF && len >= 2 && apply(len - 2) == CR) len - 2 else len - 1)
- else
- self
- }
- }
-
- /** <p>
- * Return all lines in this string in an iterator, including trailing
- * line end characters.
- * </p>
- * <p>
- * The number of strings returned is one greater than the number of line
- * end characters in this string. For an empty string, a single empty
- * line is returned. A line end character is one of
- * </p>
- * <ul style="list-style-type: none;">
- * <li>LF - line feed (0x0A hex)</li>
- * <li>FF - form feed (0x0C hex)</li>
- * </ul>
- */
- def linesWithSeparators = new Iterator[String] {
- val len = self.length
- var index = 0
- def hasNext: Boolean = index < len
- def next(): String = {
- if (index >= len) throw new NoSuchElementException("next on empty iterator")
- val start = index
- while (index < len && !isLineBreak(apply(index))) index += 1
- index += 1
- self.substring(start, index min len)
- }
- }
-
- /** Return all lines in this string in an iterator, excluding trailing line
- * end characters, i.e. apply <code>.stripLineEnd</code> to all lines
- * returned by <code>linesWithSeparators</code>.
- */
- def lines: Iterator[String] =
- linesWithSeparators map (line => new BoxedString(line).stripLineEnd)
-
- /** Returns this string with first character converted to upper case */
- def capitalize: String =
- if (self == null) null
- else if (self.length == 0) ""
- else {
- val chars = self.toCharArray
- chars(0) = chars(0).toUpperCase
- new String(chars)
- }
-
- /** <p>
- * For every line in this string:
- * </p>
- * <blockquote>
- * Strip a leading prefix consisting of blanks or control characters
- * followed by <code>marginChar</code> from the line.
- * </blockquote>
- */
- def stripMargin(marginChar: Char): String = {
- val buf = new StringBuilder
- for (line <- linesWithSeparators) {
- val len = line.length
- var index = 0
- while (index < len && line.charAt(index) <= ' ') index += 1
- buf append
- (if (index < len && line.charAt(index) == marginChar) line.substring(index + 1) else line)
- }
- buf.toString
- }
-
- /** <p>
- * For every line in this string:
- * </p>
- * <blockquote>
- * Strip a leading prefix consisting of blanks or control characters
- * followed by <code>|</code> from the line.
- * </blockquote>
- */
- def stripMargin: String = stripMargin('|')
-
- private def escape(ch: Char): String = "\\Q" + ch + "\\E"
-
- @throws(classOf[java.util.regex.PatternSyntaxException])
- def split(separator: Char): Array[String] = self.split(escape(separator))
-
- @throws(classOf[java.util.regex.PatternSyntaxException])
- def split(separators: Array[Char]): Array[String] = {
- val re = separators.foldLeft("[")(_+escape(_)) + "]"
- self.split(re)
- }
-
- /** You can follow a string with `.r', turning
- * it into a Regex. E.g.
- *
- * """A\w*""".r is the regular expression for identifiers starting with `A'.
- */
- def r: Regex = new Regex(self)
-
- def toBoolean: Boolean = parseBoolean(self)
- def toByte: Byte = java.lang.Byte.parseByte(self)
- def toShort: Short = java.lang.Short.parseShort(self)
- def toInt: Int = java.lang.Integer.parseInt(self)
- def toLong: Long = java.lang.Long.parseLong(self)
- def toFloat: Float = java.lang.Float.parseFloat(self)
- def toDouble: Double = java.lang.Double.parseDouble(self)
-
- private def parseBoolean(s: String): Boolean =
- if (s != null) s.toLowerCase match {
- case "true" => true
- case "false" => false
- case _ => throw new NumberFormatException("For input string: \""+s+"\"")
- }
- else
- throw new NumberFormatException("For input string: \"null\"")
-
- def toArray: Array[Char] = {
- val result = new Array[Char](length)
- self.getChars(0, length, result, 0)
- result
- }
-}
-
diff --git a/src/library/scalax/runtime/ScalaRunTime.scala b/src/library/scalax/runtime/ScalaRunTime.scala
deleted file mode 100755
index 0c8416be89..0000000000
--- a/src/library/scalax/runtime/ScalaRunTime.scala
+++ /dev/null
@@ -1,152 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2009, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: ScalaRunTime.scala 17000 2009-01-29 13:05:53Z odersky $
-
-
-package scalax.runtime
-
-/* The object <code>ScalaRunTime</code> provides ...
- */
-object ScalaRunTime {
-
- def isArray(x: AnyRef): Boolean = (x != null && x.getClass.isArray) || (x != null && x.isInstanceOf[BoxedArray[_]])
- def isValueClass(clazz: Class[_]) = clazz.isPrimitive()
-
- def forceBoxedArray[A <: Any](xs: Seq[A]): Array[A] = {
- val array = new Array[A](xs.length)
- var i = 0
- for (x <- xs.elements) { array(i) = x; i += 1 }
- array
- }
-
- def checkInitialized[T <: AnyRef](x: T): T =
- if (x == null) throw new UninitializedError else x
-
- abstract class Try[a] {
- def Catch[b >: a](handler: PartialFunction[Throwable, b]): b
- def Finally(handler: Unit): a
- }
-
- def Try[a](block: => a): Try[a] = new Try[a] with Runnable {
- var result: a = _
- var exception: Throwable = scala.runtime.ExceptionHandling.tryCatch(this)
-
- def run(): Unit = result = block
-
- def Catch[b >: a](handler: PartialFunction[Throwable, b]): b =
- if (exception eq null)
- result.asInstanceOf[b]
- // !!! else if (exception is LocalReturn)
- // !!! // ...
- else if (handler isDefinedAt exception)
- handler(exception)
- else
- throw exception
-
- def Finally(handler: Unit): a =
- if (exception eq null)
- result.asInstanceOf[a]
- else
- throw exception
- }
-
- def caseFields(x: Product): List[Any] = {
- val arity = x.productArity
- def fields(from: Int): List[Any] =
- if (from == arity) List()
- else x.productElement(from) :: fields(from + 1)
- fields(0)
- }
-
- def _toString(x: Product): String =
- caseFields(x).mkString(x.productPrefix + "(", ",", ")")
-
- def _hashCode(x: Product): Int = {
- var code = x.getClass().hashCode()
- val arr = x.productArity
- var i = 0
- while (i < arr) {
- val elem = x.productElement(i)
- code = code * 41 + (if (elem == null) 0 else elem.hashCode())
- i += 1
- }
- code
- }
-
- def _equals(x: Product, y: Any): Boolean = y match {
- case y1: Product if x.productArity == y1.productArity =>
- val arity = x.productArity
- var i = 0
- while (i < arity && x.productElement(i) == y1.productElement(i))
- i += 1
- i == arity
- case _ =>
- false
- }
-
- def _equalsWithVarArgs(x: Product, y: Any): Boolean = y match {
- case y1: Product if x.productArity == y1.productArity =>
- val arity = x.productArity
- var i = 0
- while (i < arity - 1 && x.productElement(i) == y1.productElement(i))
- i += 1
- i == arity - 1 && {
- x.productElement(i) match {
- case xs: Seq[_] =>
- y1.productElement(i) match {
- case ys: Seq[_] => xs sameElements ys
- }
- }
- }
- case _ =>
- false
- }
-
- //def checkDefined[T >: Null](x: T): T =
- // if (x == null) throw new UndefinedException else x
-
- def Seq[a](xs: a*): Seq[a] = null // interpreted specially by new backend.
-
- def arrayValue[A](x: BoxedArray[A], elemClass: Class[_]): AnyRef =
- if (x eq null) null else x.unbox(elemClass)
-
- def boxArray(value: AnyRef): BoxedArray[_] = value match {
- case x: Array[Byte] => new BoxedByteArray(x)
-/*
- case x: Array[Short] => new BoxedShortArray(x)
- case x: Array[Char] => new BoxedCharArray(x)
- case x: Array[Int] => new BoxedIntArray(x)
- case x: Array[Long] => new BoxedLongArray(x)
- case x: Array[Float] => new BoxedFloatArray(x)
- case x: Array[Double] => new BoxedDoubleArray(x)
- case x: Array[Boolean] => new BoxedBooleanArray(x)
- case x: Array[AnyRef] => new BoxedObjectArray(x)
-*/
- case x: BoxedArray[_] => x
- }
-
- /** Given any Scala value, convert it to a String.
- *
- * The primary motivation for this method is to provide a means for
- * correctly obtaining a String representation of a value, while
- * avoiding the pitfalls of naïvely calling toString on said value.
- * In particular, it addresses the fact that (a) toString cannot be
- * called on null and (b) depending on the apparent type of an
- * array, toString may or may not print it in a human-readable form.
- *
- * @param arg the value to stringify
- * @return a string representation of <code>arg</code>
- *
- */
- def stringOf(arg : Any): String = arg match {
- case null => "null"
- case (arg : AnyRef) if isArray(arg) => boxArray(arg).deepToString
- case arg => arg.toString
- }
-}
diff --git a/src/library/scalax/runtime/StringVector.scala b/src/library/scalax/runtime/StringVector.scala
deleted file mode 100644
index a612b7d7a5..0000000000
--- a/src/library/scalax/runtime/StringVector.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-// $Id: Buffer.scala 15799 2008-08-15 18:23:54Z odersky $
-
-
-package scalax.runtime
-
-import collection.immutable.Vector
-import collection.mutable.ArrayBuffer
-import collection.generic.VectorTemplate
-import annotation.unchecked.uncheckedVariance
-
-object StringVector {
-
- implicit def unbox(sv: StringVector[Char]): String = sv.mkString
-
-}
-
-@cloneable
-abstract class StringVector[+A] extends VectorTemplate[StringVector, A @uncheckedVariance] with Vector[A] {
-
- /** The length of the string */
- def length: Int
-
- /** The element at given index */
- def apply(idx: Int): A
-
- /** Creates new builder for this collection */
- def newBuilder[B] = new ArrayBuffer[B].mapResult[StringVector] { // !!! Adriaan: can't drop [StringVector] here
- buf => new StringVector[B] {
- def length = buf.length
- def apply(n: Int) = buf.apply(n)
- override def foreach(f: B => Unit) = buf.foreach(f)
- }
- }
-
- def unbox: String = {
- val sb = new StringBuilder
- for (x <- this)
- sb append x.asInstanceOf[Char]
- sb.toString
- }
-
- override def toString = mkString
-
-}
-
-