Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pavel V. Talanov
2012-07-04 20:59:26 +04:00
@@ -5,11 +5,12 @@ import java.util.NoSuchElementException
// TODO should not need this - its here for the JS stuff // TODO should not need this - its here for the JS stuff
import java.lang.UnsupportedOperationException import java.lang.UnsupportedOperationException
public enum class State { // not using an enum for now as JS generation doesn't support it
Ready public object State {
NotReady val Ready = 0
Done val NotReady = 1
Failed val Done = 2
val Failed = 3
} }
/** /**
@@ -17,7 +18,7 @@ public enum class State {
* to implement the iterator, calling [[done()]] when the iteration is complete. * to implement the iterator, calling [[done()]] when the iteration is complete.
*/ */
public abstract class AbstractIterator<T>: java.util.Iterator<T> { public abstract class AbstractIterator<T>: java.util.Iterator<T> {
private var state: State = State.NotReady private var state = State.NotReady
private var next: T? = null private var next: T? = null
override fun hasNext(): Boolean { override fun hasNext(): Boolean {
@@ -111,7 +112,7 @@ class CompositeIterator<T>(vararg iterators: java.util.Iterator<T>): AbstractIte
val iter = currentIter val iter = currentIter
if (iter != null) { if (iter != null) {
if (iter.hasNext()) { if (iter.hasNext()) {
setNext(iter.next()) setNext(iter.next()!!)
return return
} else { } else {
currentIter = null currentIter = null