From b9cfe254ac11cf811ffd5a32bfd614503ffacaf8 Mon Sep 17 00:00:00 2001 From: Sean McDirmid Date: Tue, 22 May 2007 10:18:12 +0000 Subject: Updated tests so they would pass. --- src/dotnet-library/scala/runtime/RichChar.scala | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/dotnet-library') 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) } -- cgit v1.2.3