removed kotlin Iterable, Iterator
from kotlin runtime inner classes 'MyIterator' renamed (it appeared in error messages)
This commit is contained in:
@@ -18,14 +18,22 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class BooleanIterator implements Iterator<Boolean> {
|
||||
@Override
|
||||
public final Boolean next() {
|
||||
return nextBoolean();
|
||||
}
|
||||
|
||||
public abstract boolean nextBoolean();
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,22 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class ByteIterator implements Iterator<Byte> {
|
||||
@Override
|
||||
public final Byte next() {
|
||||
return nextByte();
|
||||
}
|
||||
|
||||
public abstract byte nextByte();
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,28 +101,28 @@ public final class ByteRange implements Range<Byte>, ByteIterable {
|
||||
|
||||
public ByteIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -count, -step);
|
||||
return new ByteIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new MyIterator(start, count, step);
|
||||
return new ByteIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ByteIterator iterator() {
|
||||
return new MyIterator(start, count, 1);
|
||||
return new ByteIteratorImpl(start, count, 1);
|
||||
}
|
||||
|
||||
public static ByteRange count(int length) {
|
||||
return new ByteRange((byte) 0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends ByteIterator {
|
||||
private static class ByteIteratorImpl extends ByteIterator {
|
||||
private final int step;
|
||||
private byte cur;
|
||||
private int step;
|
||||
private int count;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(byte startValue, int count, int step) {
|
||||
public ByteIteratorImpl(byte startValue, int count, int step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (count < 0) {
|
||||
@@ -137,7 +137,7 @@ public final class ByteRange implements Range<Byte>, ByteIterable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,22 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class CharIterator implements Iterator<Character> {
|
||||
@Override
|
||||
public final Character next() {
|
||||
return nextChar();
|
||||
}
|
||||
|
||||
public abstract char nextChar();
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,28 +101,28 @@ public final class CharRange implements Range<Character>, CharIterable {
|
||||
|
||||
public CharIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -count, -step);
|
||||
return new CharIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new MyIterator(start, count, step);
|
||||
return new CharIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharIterator iterator() {
|
||||
return new MyIterator(start, count, 1);
|
||||
return new CharIteratorImpl(start, count, 1);
|
||||
}
|
||||
|
||||
public static CharRange count(int length) {
|
||||
return new CharRange((char) 0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends CharIterator {
|
||||
private static class CharIteratorImpl extends CharIterator {
|
||||
private final int step;
|
||||
private char cur;
|
||||
private int step;
|
||||
private int count;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(char startValue, int count, int step) {
|
||||
public CharIteratorImpl(char startValue, int count, int step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (count < 0) {
|
||||
@@ -137,7 +137,7 @@ public final class CharRange implements Range<Character>, CharIterable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,22 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class DoubleIterator implements Iterator<Double> {
|
||||
@Override
|
||||
public final Double next() {
|
||||
return nextDouble();
|
||||
}
|
||||
|
||||
public abstract double nextDouble();
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ public final class DoubleRange implements Range<Double> {
|
||||
|
||||
public DoubleIterator step(double step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -size, -step);
|
||||
return new DoubleIteratorImpl(getEnd(), -size, -step);
|
||||
else
|
||||
return new MyIterator(start, size, step);
|
||||
return new DoubleIteratorImpl(start, size, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
@@ -104,14 +104,14 @@ public final class DoubleRange implements Range<Double> {
|
||||
return new DoubleRange(0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends DoubleIterator {
|
||||
private double cur;
|
||||
private double step;
|
||||
private static class DoubleIteratorImpl extends DoubleIterator {
|
||||
private final double step;
|
||||
private final double end;
|
||||
private double cur;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(double startValue, double size, double step) {
|
||||
public DoubleIteratorImpl(double startValue, double size, double step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (size < 0) {
|
||||
@@ -126,7 +126,7 @@ public final class DoubleRange implements Range<Double> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
if (reversed)
|
||||
return cur >= end;
|
||||
else
|
||||
|
||||
@@ -18,14 +18,23 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class FloatIterator implements Iterator<Float> {
|
||||
@Override
|
||||
public final Float next() {
|
||||
return nextFloat();
|
||||
}
|
||||
|
||||
public abstract float nextFloat();
|
||||
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ public final class FloatRange implements Range<Float> {
|
||||
|
||||
public FloatIterator step(float step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -size, -step);
|
||||
return new FloatIteratorImpl(getEnd(), -size, -step);
|
||||
else
|
||||
return new MyIterator(start, size, step);
|
||||
return new FloatIteratorImpl(start, size, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
@@ -100,14 +100,14 @@ public final class FloatRange implements Range<Float> {
|
||||
return new FloatRange(0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends FloatIterator {
|
||||
private float cur;
|
||||
private float step;
|
||||
private static class FloatIteratorImpl extends FloatIterator {
|
||||
private final float step;
|
||||
private final float end;
|
||||
private float cur;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(float startValue, float size, float step) {
|
||||
public FloatIteratorImpl(float startValue, float size, float step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (size < 0) {
|
||||
@@ -122,7 +122,7 @@ public final class FloatRange implements Range<Float> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
if (reversed)
|
||||
return cur >= end;
|
||||
else
|
||||
|
||||
@@ -18,14 +18,23 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class IntIterator implements Iterator<Integer> {
|
||||
@Override
|
||||
public final Integer next() {
|
||||
return nextInt();
|
||||
}
|
||||
|
||||
public abstract int nextInt();
|
||||
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ public final class IntRange implements Range<Integer>, IntIterable {
|
||||
|
||||
public IntIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -count, -step);
|
||||
return new IntIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new MyIterator(start, count, step);
|
||||
return new IntIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
public boolean getIsReversed() {
|
||||
@@ -108,21 +108,21 @@ public final class IntRange implements Range<Integer>, IntIterable {
|
||||
|
||||
@Override
|
||||
public IntIterator iterator() {
|
||||
return new MyIterator(start, count, 1);
|
||||
return new IntIteratorImpl(start, count, 1);
|
||||
}
|
||||
|
||||
public static IntRange count(int length) {
|
||||
return new IntRange(0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends IntIterator {
|
||||
private static class IntIteratorImpl extends IntIterator {
|
||||
private int cur;
|
||||
private int step;
|
||||
private int count;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(int startValue, int count, int step) {
|
||||
public IntIteratorImpl(int startValue, int count, int step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (count < 0) {
|
||||
@@ -137,7 +137,7 @@ public final class IntRange implements Range<Integer>, IntIterable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
@AssertInvisibleInResolver
|
||||
public interface Iterable<T> {
|
||||
Iterator<T> iterator ();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package jet;
|
||||
|
||||
import jet.runtime.typeinfo.JetMethod;
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
@AssertInvisibleInResolver
|
||||
public interface Iterator<T> {
|
||||
boolean getHasNext();
|
||||
T next ();
|
||||
}
|
||||
@@ -18,14 +18,22 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class LongIterator implements Iterator<Long> {
|
||||
@Override
|
||||
public final Long next() {
|
||||
return nextLong();
|
||||
}
|
||||
|
||||
public abstract long nextLong();
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ public final class LongRange implements Range<Long>, LongIterable {
|
||||
|
||||
public LongIterator step(long step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -count, -step);
|
||||
return new LongIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new MyIterator(start, count, step);
|
||||
return new LongIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,21 +109,21 @@ public final class LongRange implements Range<Long>, LongIterable {
|
||||
|
||||
@Override
|
||||
public LongIterator iterator() {
|
||||
return new MyIterator(start, count, 1);
|
||||
return new LongIteratorImpl(start, count, 1);
|
||||
}
|
||||
|
||||
public static LongRange count(int length) {
|
||||
return new LongRange(0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends LongIterator {
|
||||
private static class LongIteratorImpl extends LongIterator {
|
||||
private final long step;
|
||||
private long cur;
|
||||
private long step;
|
||||
private long count;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(long startValue, long count, long step) {
|
||||
public LongIteratorImpl(long startValue, long count, long step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (count < 0) {
|
||||
@@ -138,7 +138,7 @@ public final class LongRange implements Range<Long>, LongIterable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,14 +18,23 @@ package jet;
|
||||
|
||||
import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@AssertInvisibleInResolver
|
||||
public abstract class ShortIterator implements Iterator<Short> {
|
||||
@Override
|
||||
public final Short next() {
|
||||
return nextShort();
|
||||
}
|
||||
|
||||
public abstract short nextShort();
|
||||
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public final class ShortRange implements Range<Short>, ShortIterable {
|
||||
|
||||
public ShortIterator step(int step) {
|
||||
if (step < 0)
|
||||
return new MyIterator(getEnd(), -count, -step);
|
||||
return new ShortIteratorImpl(getEnd(), -count, -step);
|
||||
else
|
||||
return new MyIterator(start, count, step);
|
||||
return new ShortIteratorImpl(start, count, step);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,21 +108,21 @@ public final class ShortRange implements Range<Short>, ShortIterable {
|
||||
|
||||
@Override
|
||||
public ShortIterator iterator() {
|
||||
return new MyIterator(start, count, 1);
|
||||
return new ShortIteratorImpl(start, count, 1);
|
||||
}
|
||||
|
||||
public static ShortRange count(int length) {
|
||||
return new ShortRange((byte) 0, length);
|
||||
}
|
||||
|
||||
private static class MyIterator extends ShortIterator {
|
||||
private static class ShortIteratorImpl extends ShortIterator {
|
||||
private final int step;
|
||||
private short cur;
|
||||
private int step;
|
||||
private int count;
|
||||
|
||||
private final boolean reversed;
|
||||
|
||||
public MyIterator(short startValue, int count, int step) {
|
||||
public ShortIteratorImpl(short startValue, int count, int step) {
|
||||
cur = startValue;
|
||||
this.step = step;
|
||||
if (count < 0) {
|
||||
@@ -137,7 +137,7 @@ public final class ShortRange implements Range<Short>, ShortIterable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ package jet.runtime;
|
||||
|
||||
import jet.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
@@ -30,7 +32,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < size;
|
||||
}
|
||||
|
||||
@@ -46,6 +48,11 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
public T next() {
|
||||
return array[index++];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException("Mutating method called on a Kotlin Iterator");
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> Iterator<T> iterator(T[] array) {
|
||||
@@ -57,7 +64,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
@@ -81,7 +88,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
@@ -99,17 +106,17 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
return new ArrayShortIterator(array);
|
||||
}
|
||||
|
||||
private static class ArrayIntegerIterator extends IntIterator {
|
||||
private static class ArrayIntIterator extends IntIterator {
|
||||
private final int[] array;
|
||||
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
private ArrayIntegerIterator(int[] array) {
|
||||
private ArrayIntIterator(int[] array) {
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
@@ -120,7 +127,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
}
|
||||
|
||||
public static IntIterator iterator(int[] array) {
|
||||
return new ArrayIntegerIterator(array);
|
||||
return new ArrayIntIterator(array);
|
||||
}
|
||||
|
||||
private static class ArrayLongIterator extends LongIterator {
|
||||
@@ -129,7 +136,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
@@ -153,7 +160,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
@@ -177,7 +184,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
@@ -201,7 +208,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
@@ -225,7 +232,7 @@ public abstract class ArrayIterator<T> implements Iterator<T> {
|
||||
private int index;
|
||||
|
||||
@Override
|
||||
public boolean getHasNext() {
|
||||
public boolean hasNext() {
|
||||
return index < array.length;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user