diff options
author | michelou <michelou@epfl.ch> | 2007-07-20 10:46:52 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-07-20 10:46:52 +0000 |
commit | bd9874055fa2fbd2d848e59973c2b6b87f0e1fac (patch) | |
tree | 817c7076a8410fdbf2199a3b002c59540d4a974d /src/library | |
parent | 62d7f4c35a302d65fb3b17c8b15f3f1c86601639 (diff) | |
download | scala-bd9874055fa2fbd2d848e59973c2b6b87f0e1fac.tar.gz scala-bd9874055fa2fbd2d848e59973c2b6b87f0e1fac.tar.bz2 scala-bd9874055fa2fbd2d848e59973c2b6b87f0e1fac.zip |
minor changes
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Stream.scala | 6 | ||||
-rw-r--r-- | src/library/scala/runtime/RichString.scala | 53 |
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) } |