diff options
author | Sean McDirmid <sean.mcdirmid@gmail.com> | 2007-05-22 10:18:12 +0000 |
---|---|---|
committer | Sean McDirmid <sean.mcdirmid@gmail.com> | 2007-05-22 10:18:12 +0000 |
commit | b9cfe254ac11cf811ffd5a32bfd614503ffacaf8 (patch) | |
tree | a70c13971de1ad7fbcdd6f580d329bd2717bc4f4 /src/dotnet-library | |
parent | 2cab50f0f08b63d9fc1c5248974411910b18a560 (diff) | |
download | scala-b9cfe254ac11cf811ffd5a32bfd614503ffacaf8.tar.gz scala-b9cfe254ac11cf811ffd5a32bfd614503ffacaf8.tar.bz2 scala-b9cfe254ac11cf811ffd5a32bfd614503ffacaf8.zip |
Updated tests so they would pass.
Diffstat (limited to 'src/dotnet-library')
-rw-r--r-- | src/dotnet-library/scala/runtime/RichChar.scala | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/dotnet-library/scala/runtime/RichChar.scala b/src/dotnet-library/scala/runtime/RichChar.scala index c9cde3f11a..e35663a6dd 100644 --- a/src/dotnet-library/scala/runtime/RichChar.scala +++ b/src/dotnet-library/scala/runtime/RichChar.scala @@ -48,23 +48,20 @@ final class RichChar(x: Char) extends Proxy with Ordered[Char] { def asDigit: Int = System.Char.GetNumericValue(x).toInt - private class SequentialCharIterator(limit: Char) extends BufferedIterator[Char] { + /** Create an Iterator[Char] over the characters from 'x' to 'y' - 1 + */ + def until(limit: Char): Iterator[Char] = new Iterator[Char] { private var ch = x def hasNext: Boolean = ch < limit - def next(): Char = + def next: Char = if (hasNext) { val j = ch; ch = (ch + 1).toChar; j } else throw new NoSuchElementException("next on empty iterator") - def head: Char = - if (hasNext) ch - else throw new NoSuchElementException("head on empty iterator") } - /** Create an Iterator[Char] over the characters from 'x' to 'y' - 1 - */ - def until(y: Char): Iterator[Char] = new SequentialCharIterator(y) + //def until(y: Char): Iterator[Char] = to(y) /** Create an Iterator[Char] over the characters from 'x' to 'y' */ - def to(y: Char): Iterator[Char] = new SequentialCharIterator((y + 1).toChar) + def to(y: Char): Iterator[Char] = until((y + 1).toChar) } |