Projections & Initial grammar

This commit is contained in:
Andrey Breslav
2010-11-15 15:28:25 +03:00
parent 54ccb2e184
commit 6d6a22de1d
9 changed files with 231 additions and 3 deletions
+3 -3
View File
@@ -2,16 +2,16 @@ interface class IIterator<out T> {
fun next() : T
val hasNext : Boolean
fun toArray(buffer : WriteOnlyArray<T>) : Int { // T is still an in-parameter
fun toArray(buffer : MutableArray<in T>) : Int { // T is still an in-parameter
return fillBuffer(buffer, 0, buffer.size)
}
fun toArray(buffer : WriteOnlyArray<T>, from : Int, length : Int) : Int { // T is still an in-parameter
fun toArray(buffer : MutableArray<in T>, from : Int, length : Int) : Int { // T is still an in-parameter
if (from < 0 || from > buffer.lastIndex || length < 0 || length > buffer.size - from) {
throw IndexOutOfBoundsException();
}
if (len == 0) return 0;
if (len == 0) return 0
var count = 0;
for (i in [from .. from + length - 1]) {