summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-07-20 10:46:52 +0000
committermichelou <michelou@epfl.ch>2007-07-20 10:46:52 +0000
commitbd9874055fa2fbd2d848e59973c2b6b87f0e1fac (patch)
tree817c7076a8410fdbf2199a3b002c59540d4a974d
parent62d7f4c35a302d65fb3b17c8b15f3f1c86601639 (diff)
downloadscala-bd9874055fa2fbd2d848e59973c2b6b87f0e1fac.tar.gz
scala-bd9874055fa2fbd2d848e59973c2b6b87f0e1fac.tar.bz2
scala-bd9874055fa2fbd2d848e59973c2b6b87f0e1fac.zip
minor changes
-rw-r--r--src/library/scala/Stream.scala6
-rw-r--r--src/library/scala/runtime/RichString.scala53
2 files changed, 32 insertions, 27 deletions
diff --git a/src/library/scala/Stream.scala b/src/library/scala/Stream.scala
index c03c2a72d6..14bfd258d6 100644
--- a/src/library/scala/Stream.scala
+++ b/src/library/scala/Stream.scala
@@ -1,7 +1,7 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | **
+** / __/ __// _ | / / / _ | (c) 2003-2007, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
@@ -12,7 +12,6 @@
package scala
import Predef._
-import compat.StringBuilder
/**
* The object <code>Stream</code> provides helper functions
@@ -38,7 +37,6 @@ object Stream {
protected def addDefinedElems(buf: StringBuilder, prefix: String): StringBuilder = buf
}
-
object cons {
/** A stream consisting of a given first element and remaining elements
* @param hd The first element of the result stream
diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala
index 3c7d68f84f..c109b9c9cb 100644
--- a/src/library/scala/runtime/RichString.scala
+++ b/src/library/scala/runtime/RichString.scala
@@ -19,35 +19,42 @@ final class RichString(val self: String) extends Proxy with RandomAccessSeq[Char
override def length = self.length
override def toString = self
override def mkString = self
- override def slice(from : Int, until : Int) : RichString = {
+
+ override def slice(from: Int, until: Int): RichString = {
val from0 = if (from < 0) 0 else from
val until0 = if (from >= until || from >= self.length) return new RichString("")
else if (until > self.length) self.length else until
new RichString(self.substring(from0, until0))
}
+
//override def ++ [B >: A](that: Iterable[B]): Seq[B] = {
- override def ++[B >: Char](that : Iterable[B]) : RandomAccessSeq[B] = that match {
- case that : RichString => new RichString(self + that.self)
- case that => super.++(that)
+ override def ++[B >: Char](that: Iterable[B]): RandomAccessSeq[B] = that match {
+ case that: RichString => new RichString(self + that.self)
+ case that => super.++(that)
}
- override def take(until : Int) : RichString = slice(0, until)
- override def drop(from : Int) : RichString = slice(from, self.length)
- override def startsWith[B](that : Seq[B]) = that match {
- case that : RichString => self startsWith that.self
- case that => super.startsWith(that)
+ override def take(until: Int): RichString = slice(0, until)
+
+ override def drop(from: Int): RichString = slice(from, self.length)
+
+ override def startsWith[B](that: Seq[B]) = that match {
+ case that: RichString => self startsWith that.self
+ case that => super.startsWith(that)
}
- override def endsWith[B](that : Seq[B]) = that match {
- case that : RichString => self endsWith that.self
- case that => super.endsWith(that)
+
+ override def endsWith[B](that: Seq[B]) = that match {
+ case that: RichString => self endsWith that.self
+ case that => super.endsWith(that)
}
- override def indexOf[B](that : Seq[B]) = that match {
- case that : RichString => self indexOf that.self
- case that => super.indexOf(that)
+
+ override def indexOf[B](that: Seq[B]) = that match {
+ case that: RichString => self indexOf that.self
+ case that => super.indexOf(that)
}
- override def containsSlice[B](that : Seq[B]) = that match {
- case that : RichString => self contains that.self
- case that => super.containsSlice(that)
+
+ override def containsSlice[B](that: Seq[B]) = that match {
+ case that: RichString => self contains that.self
+ case that => super.containsSlice(that)
}
override def compare(other: String) = self compareTo other
@@ -169,11 +176,11 @@ final class RichString(val self: String) extends Proxy with RandomAccessSeq[Char
self.split(re)
}
- 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 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)
}