diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java index a6f7eb3f615..c6fe16c8a2a 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/IntrinsicMethods.java @@ -157,19 +157,19 @@ public class IntrinsicMethods { } for (PrimitiveType type : PrimitiveType.NUMBER_TYPES) { - registerRangeOrSequenceProperty(type.getRangeClassName(), Name.identifier("start")); - registerRangeOrSequenceProperty(type.getRangeClassName(), Name.identifier("end")); + registerRangeOrProgressionProperty(type.getRangeClassName(), Name.identifier("start")); + registerRangeOrProgressionProperty(type.getRangeClassName(), Name.identifier("end")); - registerRangeOrSequenceProperty(type.getSequenceClassName(), Name.identifier("start")); - registerRangeOrSequenceProperty(type.getSequenceClassName(), Name.identifier("end")); - registerRangeOrSequenceProperty(type.getSequenceClassName(), Name.identifier("increment")); + registerRangeOrProgressionProperty(type.getProgressionClassName(), Name.identifier("start")); + registerRangeOrProgressionProperty(type.getProgressionClassName(), Name.identifier("end")); + registerRangeOrProgressionProperty(type.getProgressionClassName(), Name.identifier("increment")); } declareArrayMethods(); } - private void registerRangeOrSequenceProperty(@NotNull FqName ownerClass, @NotNull Name propertyName) { - intrinsicsMap.registerIntrinsic(ownerClass, propertyName, -1, new PropertyOfSequenceOrRange(ownerClass, propertyName)); + private void registerRangeOrProgressionProperty(@NotNull FqName ownerClass, @NotNull Name propertyName) { + intrinsicsMap.registerIntrinsic(ownerClass, propertyName, -1, new PropertyOfProgressionOrRange(ownerClass, propertyName)); } @NotNull diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PropertyOfSequenceOrRange.java b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PropertyOfProgressionOrRange.java similarity index 93% rename from compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PropertyOfSequenceOrRange.java rename to compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PropertyOfProgressionOrRange.java index a964c7c0fb4..0567d02b5d7 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PropertyOfSequenceOrRange.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/intrinsics/PropertyOfProgressionOrRange.java @@ -33,11 +33,11 @@ import org.jetbrains.jet.lang.resolve.name.Name; import java.util.List; -public class PropertyOfSequenceOrRange implements IntrinsicMethod { +public class PropertyOfProgressionOrRange implements IntrinsicMethod { private final FqName ownerClass; private final Name propertyName; - public PropertyOfSequenceOrRange(@NotNull FqName ownerClass, @NotNull Name propertyName) { + public PropertyOfProgressionOrRange(@NotNull FqName ownerClass, @NotNull Name propertyName) { this.ownerClass = ownerClass; this.propertyName = propertyName; } diff --git a/compiler/frontend/src/jet/Ranges.jet b/compiler/frontend/src/jet/Ranges.jet index 092f8f3144c..bdb11b37253 100644 --- a/compiler/frontend/src/jet/Ranges.jet +++ b/compiler/frontend/src/jet/Ranges.jet @@ -9,7 +9,7 @@ public trait Range> { public class IntRange( public override val start: Int, public override val end : Int -) : Range, NumberSequence { +) : Range, Progression { public override fun iterator() : IntIterator @@ -25,7 +25,7 @@ public class IntRange( public class LongRange( public override val start: Long, public override val end: Long -) : Range, NumberSequence { +) : Range, Progression { public override fun iterator(): LongIterator @@ -41,7 +41,7 @@ public class LongRange( public class ByteRange( public override val start: Byte, public override val end : Byte -): Range, NumberSequence { +): Range, Progression { public override fun iterator(): ByteIterator @@ -57,7 +57,7 @@ public class ByteRange( public class ShortRange( public override val start: Short, public override val end: Short -) : Range, NumberSequence { +) : Range, Progression { public override fun iterator(): ShortIterator @@ -73,7 +73,7 @@ public class ShortRange( public class CharRange( public override val start: Char, public override val end: Char -) : Range, NumberSequence { +) : Range, Progression { public override fun iterator(): CharIterator @@ -89,7 +89,7 @@ public class CharRange( public class FloatRange( public override val start: Float, public override val end: Float -) : Range, NumberSequence { +) : Range, Progression { public override fun iterator(): FloatIterator @@ -105,7 +105,7 @@ public class FloatRange( public class DoubleRange( public override val start: Double, public override val end: Double -) : Range, NumberSequence { +) : Range, Progression { public override fun iterator() : DoubleIterator @@ -119,71 +119,71 @@ public class DoubleRange( } -public trait NumberSequence: Iterable { +public trait Progression: Iterable { public val start: N public val end: N public val increment: Number } -public class IntSequence( +public class IntProgression( public override val start: Int, public override val end: Int, public override val increment: Int -): NumberSequence { +): Progression { override fun iterator(): IntIterator } -public class LongSequence( +public class LongProgression( public override val start: Long, public override val end: Long, public override val increment: Long -): NumberSequence { +): Progression { override fun iterator(): LongIterator } -public class ByteSequence( +public class ByteProgression( public override val start: Byte, public override val end: Byte, public override val increment: Int -): NumberSequence { +): Progression { override fun iterator(): ByteIterator } -public class ShortSequence( +public class ShortProgression( public override val start: Short, public override val end: Short, public override val increment: Int -): NumberSequence { +): Progression { override fun iterator(): ShortIterator } -public class CharacterSequence( +public class CharProgression( public override val start: Char, public override val end: Char, public override val increment: Int -): NumberSequence { +): Progression { override fun iterator(): CharIterator } -public class FloatSequence( +public class FloatProgression( public override val start: Float, public override val end: Float, public override val increment: Float -): NumberSequence { +): Progression { override fun iterator(): FloatIterator } -public class DoubleSequence( +public class DoubleProgression( public override val start: Double, public override val end: Double, public override val increment: Double -): NumberSequence { +): Progression { override fun iterator(): DoubleIterator } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/PrimitiveType.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/PrimitiveType.java index 7af5fde467b..8acd79a3eaf 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/PrimitiveType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/PrimitiveType.java @@ -41,7 +41,7 @@ public enum PrimitiveType { private final FqName className; private final FqName arrayClassName; private final FqName rangeClassName; - private final FqName sequenceClassName; + private final FqName progressionClassName; private PrimitiveType(String typeName) { this.typeName = Name.identifier(typeName); @@ -51,8 +51,7 @@ public enum PrimitiveType { this.className = builtInsPackageFqName.child(this.typeName); this.arrayClassName = builtInsPackageFqName.child(this.arrayTypeName); this.rangeClassName = builtInsPackageFqName.child(this.rangeTypeName); - this.sequenceClassName = builtInsPackageFqName.child( - Name.identifier((typeName == "Char") ? "CharacterSequence" : typeName + "Sequence")); + this.progressionClassName = builtInsPackageFqName.child(Name.identifier(typeName + "Progression")); } @NotNull @@ -86,7 +85,7 @@ public enum PrimitiveType { } @NotNull - public FqName getSequenceClassName() { - return sequenceClassName; + public FqName getProgressionClassName() { + return progressionClassName; } } diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index 6322ab5ca0b..67f81cedf0d 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -131,7 +131,15 @@ public abstract class ByteIterator : jet.Iterator { public abstract fun nextByte() : jet.Byte } -public final class ByteRange : jet.Range, jet.NumberSequence { +public final class ByteProgression : jet.Progression { + public constructor ByteProgression(/*0*/ start : jet.Byte, /*1*/ end : jet.Byte, /*2*/ increment : jet.Int) + public open override /*1*/ val end : jet.Byte + public open override /*1*/ val increment : jet.Int + public open override /*1*/ val start : jet.Byte + public open override /*1*/ fun iterator() : jet.ByteIterator +} + +public final class ByteRange : jet.Range, jet.Progression { public constructor ByteRange(/*0*/ start : jet.Byte, /*1*/ end : jet.Byte) public open override /*2*/ val end : jet.Byte public open override /*1*/ val increment : jet.Int @@ -145,14 +153,6 @@ public final class ByteRange : jet.Range, jet.NumberSequence } } -public final class ByteSequence : jet.NumberSequence { - public constructor ByteSequence(/*0*/ start : jet.Byte, /*1*/ end : jet.Byte, /*2*/ increment : jet.Int) - public open override /*1*/ val end : jet.Byte - public open override /*1*/ val increment : jet.Int - public open override /*1*/ val start : jet.Byte - public open override /*1*/ fun iterator() : jet.ByteIterator -} - public final class Char : jet.Number, jet.Comparable { public constructor Char() public final fun compareTo(/*0*/ other : jet.Byte) : jet.Int @@ -225,7 +225,15 @@ public abstract class CharIterator : jet.Iterator { public abstract fun nextChar() : jet.Char } -public final class CharRange : jet.Range, jet.NumberSequence { +public final class CharProgression : jet.Progression { + public constructor CharProgression(/*0*/ start : jet.Char, /*1*/ end : jet.Char, /*2*/ increment : jet.Int) + public open override /*1*/ val end : jet.Char + public open override /*1*/ val increment : jet.Int + public open override /*1*/ val start : jet.Char + public open override /*1*/ fun iterator() : jet.CharIterator +} + +public final class CharRange : jet.Range, jet.Progression { public constructor CharRange(/*0*/ start : jet.Char, /*1*/ end : jet.Char) public open override /*2*/ val end : jet.Char public open override /*1*/ val increment : jet.Int @@ -245,14 +253,6 @@ public trait CharSequence { public abstract fun toString() : jet.String } -public final class CharacterSequence : jet.NumberSequence { - public constructor CharacterSequence(/*0*/ start : jet.Char, /*1*/ end : jet.Char, /*2*/ increment : jet.Int) - public open override /*1*/ val end : jet.Char - public open override /*1*/ val increment : jet.Int - public open override /*1*/ val start : jet.Char - public open override /*1*/ fun iterator() : jet.CharIterator -} - public trait Collection : jet.Iterable, jet.Hashable { public abstract fun contains(/*0*/ o : jet.Any?) : jet.Boolean public abstract fun containsAll(/*0*/ c : jet.Collection) : jet.Boolean @@ -350,7 +350,15 @@ public abstract class DoubleIterator : jet.Iterator { public abstract fun nextDouble() : jet.Double } -public final class DoubleRange : jet.Range, jet.NumberSequence { +public final class DoubleProgression : jet.Progression { + public constructor DoubleProgression(/*0*/ start : jet.Double, /*1*/ end : jet.Double, /*2*/ increment : jet.Double) + public open override /*1*/ val end : jet.Double + public open override /*1*/ val increment : jet.Double + public open override /*1*/ val start : jet.Double + public open override /*1*/ fun iterator() : jet.DoubleIterator +} + +public final class DoubleRange : jet.Range, jet.Progression { public constructor DoubleRange(/*0*/ start : jet.Double, /*1*/ end : jet.Double) public open override /*2*/ val end : jet.Double public open override /*1*/ val increment : jet.Double @@ -364,14 +372,6 @@ public final class DoubleRange : jet.Range, jet.NumberSequence { - public constructor DoubleSequence(/*0*/ start : jet.Double, /*1*/ end : jet.Double, /*2*/ increment : jet.Double) - public open override /*1*/ val end : jet.Double - public open override /*1*/ val increment : jet.Double - public open override /*1*/ val start : jet.Double - public open override /*1*/ fun iterator() : jet.DoubleIterator -} - public abstract class Enum> { public constructor Enum>(/*0*/ name : jet.String, /*1*/ ordinal : jet.Int) public final fun name() : jet.String @@ -575,7 +575,15 @@ public abstract class FloatIterator : jet.Iterator { public abstract fun nextFloat() : jet.Float } -public final class FloatRange : jet.Range, jet.NumberSequence { +public final class FloatProgression : jet.Progression { + public constructor FloatProgression(/*0*/ start : jet.Float, /*1*/ end : jet.Float, /*2*/ increment : jet.Float) + public open override /*1*/ val end : jet.Float + public open override /*1*/ val increment : jet.Float + public open override /*1*/ val start : jet.Float + public open override /*1*/ fun iterator() : jet.FloatIterator +} + +public final class FloatRange : jet.Range, jet.Progression { public constructor FloatRange(/*0*/ start : jet.Float, /*1*/ end : jet.Float) public open override /*2*/ val end : jet.Float public open override /*1*/ val increment : jet.Float @@ -589,14 +597,6 @@ public final class FloatRange : jet.Range, jet.NumberSequence { - public constructor FloatSequence(/*0*/ start : jet.Float, /*1*/ end : jet.Float, /*2*/ increment : jet.Float) - public open override /*1*/ val end : jet.Float - public open override /*1*/ val increment : jet.Float - public open override /*1*/ val start : jet.Float - public open override /*1*/ fun iterator() : jet.FloatIterator -} - public abstract class Function0 { public constructor Function0() public abstract fun invoke() : R @@ -806,7 +806,15 @@ public abstract class IntIterator : jet.Iterator { public abstract fun nextInt() : jet.Int } -public final class IntRange : jet.Range, jet.NumberSequence { +public final class IntProgression : jet.Progression { + public constructor IntProgression(/*0*/ start : jet.Int, /*1*/ end : jet.Int, /*2*/ increment : jet.Int) + public open override /*1*/ val end : jet.Int + public open override /*1*/ val increment : jet.Int + public open override /*1*/ val start : jet.Int + public open override /*1*/ fun iterator() : jet.IntIterator +} + +public final class IntRange : jet.Range, jet.Progression { public constructor IntRange(/*0*/ start : jet.Int, /*1*/ end : jet.Int) public open override /*2*/ val end : jet.Int public open override /*1*/ val increment : jet.Int @@ -820,14 +828,6 @@ public final class IntRange : jet.Range, jet.NumberSequence { } } -public final class IntSequence : jet.NumberSequence { - public constructor IntSequence(/*0*/ start : jet.Int, /*1*/ end : jet.Int, /*2*/ increment : jet.Int) - public open override /*1*/ val end : jet.Int - public open override /*1*/ val increment : jet.Int - public open override /*1*/ val start : jet.Int - public open override /*1*/ fun iterator() : jet.IntIterator -} - public trait Iterable { public abstract fun iterator() : jet.Iterator } @@ -953,7 +953,15 @@ public abstract class LongIterator : jet.Iterator { public abstract fun nextLong() : jet.Long } -public final class LongRange : jet.Range, jet.NumberSequence { +public final class LongProgression : jet.Progression { + public constructor LongProgression(/*0*/ start : jet.Long, /*1*/ end : jet.Long, /*2*/ increment : jet.Long) + public open override /*1*/ val end : jet.Long + public open override /*1*/ val increment : jet.Long + public open override /*1*/ val start : jet.Long + public open override /*1*/ fun iterator() : jet.LongIterator +} + +public final class LongRange : jet.Range, jet.Progression { public constructor LongRange(/*0*/ start : jet.Long, /*1*/ end : jet.Long) public open override /*2*/ val end : jet.Long public open override /*1*/ val increment : jet.Long @@ -967,14 +975,6 @@ public final class LongRange : jet.Range, jet.NumberSequence } } -public final class LongSequence : jet.NumberSequence { - public constructor LongSequence(/*0*/ start : jet.Long, /*1*/ end : jet.Long, /*2*/ increment : jet.Long) - public open override /*1*/ val end : jet.Long - public open override /*1*/ val increment : jet.Long - public open override /*1*/ val start : jet.Long - public open override /*1*/ fun iterator() : jet.LongIterator -} - public trait Map { public abstract fun containsKey(/*0*/ key : jet.Any?) : jet.Boolean public abstract fun containsValue(/*0*/ value : jet.Any?) : jet.Boolean @@ -1119,7 +1119,7 @@ public abstract class Number : jet.Hashable { public abstract fun toShort() : jet.Short } -public trait NumberSequence : jet.Iterable { +public trait Progression : jet.Iterable { public abstract val end : N public abstract val increment : jet.Number public abstract val start : N @@ -1226,7 +1226,15 @@ public abstract class ShortIterator : jet.Iterator { public abstract fun nextShort() : jet.Short } -public final class ShortRange : jet.Range, jet.NumberSequence { +public final class ShortProgression : jet.Progression { + public constructor ShortProgression(/*0*/ start : jet.Short, /*1*/ end : jet.Short, /*2*/ increment : jet.Int) + public open override /*1*/ val end : jet.Short + public open override /*1*/ val increment : jet.Int + public open override /*1*/ val start : jet.Short + public open override /*1*/ fun iterator() : jet.ShortIterator +} + +public final class ShortRange : jet.Range, jet.Progression { public constructor ShortRange(/*0*/ start : jet.Short, /*1*/ end : jet.Short) public open override /*2*/ val end : jet.Short public open override /*1*/ val increment : jet.Int @@ -1240,14 +1248,6 @@ public final class ShortRange : jet.Range, jet.NumberSequence { - public constructor ShortSequence(/*0*/ start : jet.Short, /*1*/ end : jet.Short, /*2*/ increment : jet.Int) - public open override /*1*/ val end : jet.Short - public open override /*1*/ val increment : jet.Int - public open override /*1*/ val start : jet.Short - public open override /*1*/ fun iterator() : jet.ShortIterator -} - public final class String : jet.Comparable, jet.CharSequence { public constructor String() public open override /*1*/ val length : jet.Int diff --git a/js/js.translator/src/org/jetbrains/k2js/translate/context/StandardClasses.java b/js/js.translator/src/org/jetbrains/k2js/translate/context/StandardClasses.java index ffc679328ce..133a64b73cd 100644 --- a/js/js.translator/src/org/jetbrains/k2js/translate/context/StandardClasses.java +++ b/js/js.translator/src/org/jetbrains/k2js/translate/context/StandardClasses.java @@ -103,7 +103,7 @@ public final class StandardClasses { standardClasses.declare().forFQ("jet.IntRange").kotlinClass("NumberRange") .methods("iterator", "contains").properties("start", "end", "increment"); - standardClasses.declare().forFQ("jet.IntSequence").kotlinClass("NumberSequence") + standardClasses.declare().forFQ("jet.IntProgression").kotlinClass("NumberProgression") .methods("iterator", "contains").properties("start", "end", "increment"); standardClasses.declare().forFQ("jet.Any.toString").kotlinFunction("toString"); diff --git a/js/js.translator/testFiles/kotlin_lib.js b/js/js.translator/testFiles/kotlin_lib.js index 3ea5856d088..98dc08721ca 100644 --- a/js/js.translator/testFiles/kotlin_lib.js +++ b/js/js.translator/testFiles/kotlin_lib.js @@ -68,7 +68,7 @@ var kotlin = {set:function (receiver, key, value) { }; Kotlin.intDownto = function (from, to) { - return Kotlin.$new(Kotlin.NumberSequence)(from, to, -1); + return Kotlin.$new(Kotlin.Progression)(from, to, -1); }; Kotlin.modules = {}; @@ -394,7 +394,7 @@ var kotlin = {set:function (receiver, key, value) { } }); - Kotlin.NumberSequence = Kotlin.$createClass({ + Kotlin.Progression = Kotlin.$createClass({ initialize: function (start, end, increment) { this.$start = start; this.$end = end; diff --git a/libraries/stdlib/src/generated/DownTo.kt b/libraries/stdlib/src/generated/DownTo.kt index 1c5c9eac106..a38289a8365 100644 --- a/libraries/stdlib/src/generated/DownTo.kt +++ b/libraries/stdlib/src/generated/DownTo.kt @@ -6,198 +6,198 @@ package kotlin // -public inline fun Byte.downTo(to: Byte): ByteSequence { - return ByteSequence(this, to, -1) +public inline fun Byte.downTo(to: Byte): ByteProgression { + return ByteProgression(this, to, -1) } -public inline fun Byte.downTo(to: Char): CharacterSequence { - return CharacterSequence(this.toChar(), to, -1) +public inline fun Byte.downTo(to: Char): CharProgression { + return CharProgression(this.toChar(), to, -1) } -public inline fun Byte.downTo(to: Short): ShortSequence { - return ShortSequence(this.toShort(), to, -1) +public inline fun Byte.downTo(to: Short): ShortProgression { + return ShortProgression(this.toShort(), to, -1) } -public inline fun Byte.downTo(to: Int): IntSequence { - return IntSequence(this.toInt(), to, -1) +public inline fun Byte.downTo(to: Int): IntProgression { + return IntProgression(this.toInt(), to, -1) } -public inline fun Byte.downTo(to: Long): LongSequence { - return LongSequence(this.toLong(), to, -1.toLong()) +public inline fun Byte.downTo(to: Long): LongProgression { + return LongProgression(this.toLong(), to, -1.toLong()) } -public inline fun Byte.downTo(to: Float): FloatSequence { - return FloatSequence(this.toFloat(), to, -1.toFloat()) +public inline fun Byte.downTo(to: Float): FloatProgression { + return FloatProgression(this.toFloat(), to, -1.toFloat()) } -public inline fun Byte.downTo(to: Double): DoubleSequence { - return DoubleSequence(this.toDouble(), to, -1.0) +public inline fun Byte.downTo(to: Double): DoubleProgression { + return DoubleProgression(this.toDouble(), to, -1.0) } -public inline fun Char.downTo(to: Byte): CharacterSequence { - return CharacterSequence(this, to.toChar(), -1) +public inline fun Char.downTo(to: Byte): CharProgression { + return CharProgression(this, to.toChar(), -1) } -public inline fun Char.downTo(to: Char): CharacterSequence { - return CharacterSequence(this, to, -1) +public inline fun Char.downTo(to: Char): CharProgression { + return CharProgression(this, to, -1) } -public inline fun Char.downTo(to: Short): ShortSequence { - return ShortSequence(this.toShort(), to, -1) +public inline fun Char.downTo(to: Short): ShortProgression { + return ShortProgression(this.toShort(), to, -1) } -public inline fun Char.downTo(to: Int): IntSequence { - return IntSequence(this.toInt(), to, -1) +public inline fun Char.downTo(to: Int): IntProgression { + return IntProgression(this.toInt(), to, -1) } -public inline fun Char.downTo(to: Long): LongSequence { - return LongSequence(this.toLong(), to, -1.toLong()) +public inline fun Char.downTo(to: Long): LongProgression { + return LongProgression(this.toLong(), to, -1.toLong()) } -public inline fun Char.downTo(to: Float): FloatSequence { - return FloatSequence(this.toFloat(), to, -1.toFloat()) +public inline fun Char.downTo(to: Float): FloatProgression { + return FloatProgression(this.toFloat(), to, -1.toFloat()) } -public inline fun Char.downTo(to: Double): DoubleSequence { - return DoubleSequence(this.toDouble(), to, -1.0) +public inline fun Char.downTo(to: Double): DoubleProgression { + return DoubleProgression(this.toDouble(), to, -1.0) } -public inline fun Short.downTo(to: Byte): ShortSequence { - return ShortSequence(this, to.toShort(), -1) +public inline fun Short.downTo(to: Byte): ShortProgression { + return ShortProgression(this, to.toShort(), -1) } -public inline fun Short.downTo(to: Char): ShortSequence { - return ShortSequence(this, to.toShort(), -1) +public inline fun Short.downTo(to: Char): ShortProgression { + return ShortProgression(this, to.toShort(), -1) } -public inline fun Short.downTo(to: Short): ShortSequence { - return ShortSequence(this, to, -1) +public inline fun Short.downTo(to: Short): ShortProgression { + return ShortProgression(this, to, -1) } -public inline fun Short.downTo(to: Int): IntSequence { - return IntSequence(this.toInt(), to, -1) +public inline fun Short.downTo(to: Int): IntProgression { + return IntProgression(this.toInt(), to, -1) } -public inline fun Short.downTo(to: Long): LongSequence { - return LongSequence(this.toLong(), to, -1.toLong()) +public inline fun Short.downTo(to: Long): LongProgression { + return LongProgression(this.toLong(), to, -1.toLong()) } -public inline fun Short.downTo(to: Float): FloatSequence { - return FloatSequence(this.toFloat(), to, -1.toFloat()) +public inline fun Short.downTo(to: Float): FloatProgression { + return FloatProgression(this.toFloat(), to, -1.toFloat()) } -public inline fun Short.downTo(to: Double): DoubleSequence { - return DoubleSequence(this.toDouble(), to, -1.0) +public inline fun Short.downTo(to: Double): DoubleProgression { + return DoubleProgression(this.toDouble(), to, -1.0) } -public inline fun Int.downTo(to: Byte): IntSequence { - return IntSequence(this, to.toInt(), -1) +public inline fun Int.downTo(to: Byte): IntProgression { + return IntProgression(this, to.toInt(), -1) } -public inline fun Int.downTo(to: Char): IntSequence { - return IntSequence(this, to.toInt(), -1) +public inline fun Int.downTo(to: Char): IntProgression { + return IntProgression(this, to.toInt(), -1) } -public inline fun Int.downTo(to: Short): IntSequence { - return IntSequence(this, to.toInt(), -1) +public inline fun Int.downTo(to: Short): IntProgression { + return IntProgression(this, to.toInt(), -1) } -public inline fun Int.downTo(to: Int): IntSequence { - return IntSequence(this, to, -1) +public inline fun Int.downTo(to: Int): IntProgression { + return IntProgression(this, to, -1) } -public inline fun Int.downTo(to: Long): LongSequence { - return LongSequence(this.toLong(), to, -1.toLong()) +public inline fun Int.downTo(to: Long): LongProgression { + return LongProgression(this.toLong(), to, -1.toLong()) } -public inline fun Int.downTo(to: Float): FloatSequence { - return FloatSequence(this.toFloat(), to, -1.toFloat()) +public inline fun Int.downTo(to: Float): FloatProgression { + return FloatProgression(this.toFloat(), to, -1.toFloat()) } -public inline fun Int.downTo(to: Double): DoubleSequence { - return DoubleSequence(this.toDouble(), to, -1.0) +public inline fun Int.downTo(to: Double): DoubleProgression { + return DoubleProgression(this.toDouble(), to, -1.0) } -public inline fun Long.downTo(to: Byte): LongSequence { - return LongSequence(this, to.toLong(), -1.toLong()) +public inline fun Long.downTo(to: Byte): LongProgression { + return LongProgression(this, to.toLong(), -1.toLong()) } -public inline fun Long.downTo(to: Char): LongSequence { - return LongSequence(this, to.toLong(), -1.toLong()) +public inline fun Long.downTo(to: Char): LongProgression { + return LongProgression(this, to.toLong(), -1.toLong()) } -public inline fun Long.downTo(to: Short): LongSequence { - return LongSequence(this, to.toLong(), -1.toLong()) +public inline fun Long.downTo(to: Short): LongProgression { + return LongProgression(this, to.toLong(), -1.toLong()) } -public inline fun Long.downTo(to: Int): LongSequence { - return LongSequence(this, to.toLong(), -1.toLong()) +public inline fun Long.downTo(to: Int): LongProgression { + return LongProgression(this, to.toLong(), -1.toLong()) } -public inline fun Long.downTo(to: Long): LongSequence { - return LongSequence(this, to, -1.toLong()) +public inline fun Long.downTo(to: Long): LongProgression { + return LongProgression(this, to, -1.toLong()) } -public inline fun Long.downTo(to: Float): FloatSequence { - return FloatSequence(this.toFloat(), to, -1.toFloat()) +public inline fun Long.downTo(to: Float): FloatProgression { + return FloatProgression(this.toFloat(), to, -1.toFloat()) } -public inline fun Long.downTo(to: Double): DoubleSequence { - return DoubleSequence(this.toDouble(), to, -1.0) +public inline fun Long.downTo(to: Double): DoubleProgression { + return DoubleProgression(this.toDouble(), to, -1.0) } -public inline fun Float.downTo(to: Byte): FloatSequence { - return FloatSequence(this, to.toFloat(), -1.toFloat()) +public inline fun Float.downTo(to: Byte): FloatProgression { + return FloatProgression(this, to.toFloat(), -1.toFloat()) } -public inline fun Float.downTo(to: Char): FloatSequence { - return FloatSequence(this, to.toFloat(), -1.toFloat()) +public inline fun Float.downTo(to: Char): FloatProgression { + return FloatProgression(this, to.toFloat(), -1.toFloat()) } -public inline fun Float.downTo(to: Short): FloatSequence { - return FloatSequence(this, to.toFloat(), -1.toFloat()) +public inline fun Float.downTo(to: Short): FloatProgression { + return FloatProgression(this, to.toFloat(), -1.toFloat()) } -public inline fun Float.downTo(to: Int): FloatSequence { - return FloatSequence(this, to.toFloat(), -1.toFloat()) +public inline fun Float.downTo(to: Int): FloatProgression { + return FloatProgression(this, to.toFloat(), -1.toFloat()) } -public inline fun Float.downTo(to: Long): FloatSequence { - return FloatSequence(this, to.toFloat(), -1.toFloat()) +public inline fun Float.downTo(to: Long): FloatProgression { + return FloatProgression(this, to.toFloat(), -1.toFloat()) } -public inline fun Float.downTo(to: Float): FloatSequence { - return FloatSequence(this, to, -1.toFloat()) +public inline fun Float.downTo(to: Float): FloatProgression { + return FloatProgression(this, to, -1.toFloat()) } -public inline fun Float.downTo(to: Double): DoubleSequence { - return DoubleSequence(this.toDouble(), to, -1.0) +public inline fun Float.downTo(to: Double): DoubleProgression { + return DoubleProgression(this.toDouble(), to, -1.0) } -public inline fun Double.downTo(to: Byte): DoubleSequence { - return DoubleSequence(this, to.toDouble(), -1.0) +public inline fun Double.downTo(to: Byte): DoubleProgression { + return DoubleProgression(this, to.toDouble(), -1.0) } -public inline fun Double.downTo(to: Char): DoubleSequence { - return DoubleSequence(this, to.toDouble(), -1.0) +public inline fun Double.downTo(to: Char): DoubleProgression { + return DoubleProgression(this, to.toDouble(), -1.0) } -public inline fun Double.downTo(to: Short): DoubleSequence { - return DoubleSequence(this, to.toDouble(), -1.0) +public inline fun Double.downTo(to: Short): DoubleProgression { + return DoubleProgression(this, to.toDouble(), -1.0) } -public inline fun Double.downTo(to: Int): DoubleSequence { - return DoubleSequence(this, to.toDouble(), -1.0) +public inline fun Double.downTo(to: Int): DoubleProgression { + return DoubleProgression(this, to.toDouble(), -1.0) } -public inline fun Double.downTo(to: Long): DoubleSequence { - return DoubleSequence(this, to.toDouble(), -1.0) +public inline fun Double.downTo(to: Long): DoubleProgression { + return DoubleProgression(this, to.toDouble(), -1.0) } -public inline fun Double.downTo(to: Float): DoubleSequence { - return DoubleSequence(this, to.toDouble(), -1.0) +public inline fun Double.downTo(to: Float): DoubleProgression { + return DoubleProgression(this, to.toDouble(), -1.0) } -public inline fun Double.downTo(to: Double): DoubleSequence { - return DoubleSequence(this, to, -1.0) +public inline fun Double.downTo(to: Double): DoubleProgression { + return DoubleProgression(this, to, -1.0) } diff --git a/libraries/stdlib/src/kotlin/Ranges.kt b/libraries/stdlib/src/kotlin/Ranges.kt index 114899252ab..aa384d2b093 100644 --- a/libraries/stdlib/src/kotlin/Ranges.kt +++ b/libraries/stdlib/src/kotlin/Ranges.kt @@ -19,133 +19,133 @@ public fun > T.rangeTo(that: T): ComparableRange { -public fun CharacterSequence.reversed(): CharacterSequence { - return CharacterSequence(end, start, -increment) +public fun CharProgression.reversed(): CharProgression { + return CharProgression(end, start, -increment) } -public fun ByteSequence.reversed(): ByteSequence { - return ByteSequence(end, start, -increment) +public fun ByteProgression.reversed(): ByteProgression { + return ByteProgression(end, start, -increment) } -public fun ShortSequence.reversed(): ShortSequence { - return ShortSequence(end, start, -increment) +public fun ShortProgression.reversed(): ShortProgression { + return ShortProgression(end, start, -increment) } -public fun IntSequence.reversed(): IntSequence { - return IntSequence(end, start, -increment) +public fun IntProgression.reversed(): IntProgression { + return IntProgression(end, start, -increment) } -public fun FloatSequence.reversed(): FloatSequence { - return FloatSequence(end, start, -increment) +public fun FloatProgression.reversed(): FloatProgression { + return FloatProgression(end, start, -increment) } -public fun LongSequence.reversed(): LongSequence { - return LongSequence(end, start, -increment) +public fun LongProgression.reversed(): LongProgression { + return LongProgression(end, start, -increment) } -public fun DoubleSequence.reversed(): DoubleSequence { - return DoubleSequence(end, start, -increment) +public fun DoubleProgression.reversed(): DoubleProgression { + return DoubleProgression(end, start, -increment) } -public fun CharRange.reversed(): CharacterSequence { - return CharacterSequence(end, start, -1) +public fun CharRange.reversed(): CharProgression { + return CharProgression(end, start, -1) } -public fun ByteRange.reversed(): ByteSequence { - return ByteSequence(end, start, -1) +public fun ByteRange.reversed(): ByteProgression { + return ByteProgression(end, start, -1) } -public fun ShortRange.reversed(): ShortSequence { - return ShortSequence(end, start, -1) +public fun ShortRange.reversed(): ShortProgression { + return ShortProgression(end, start, -1) } -public fun IntRange.reversed(): IntSequence { - return IntSequence(end, start, -1) +public fun IntRange.reversed(): IntProgression { + return IntProgression(end, start, -1) } -public fun FloatRange.reversed(): FloatSequence { - return FloatSequence(end, start, -1.0.toFloat()) +public fun FloatRange.reversed(): FloatProgression { + return FloatProgression(end, start, -1.0.toFloat()) } -public fun LongRange.reversed(): LongSequence { - return LongSequence(end, start, -1.toLong()) +public fun LongRange.reversed(): LongProgression { + return LongProgression(end, start, -1.toLong()) } -public fun DoubleRange.reversed(): DoubleSequence { - return DoubleSequence(end, start, -1.0) +public fun DoubleRange.reversed(): DoubleProgression { + return DoubleProgression(end, start, -1.0) } -public fun IntSequence.step(step: Int): IntSequence { +public fun IntProgression.step(step: Int): IntProgression { checkStepIsPositive(step > 0, step) - return IntSequence(start, end, if (increment > 0) step else -step) + return IntProgression(start, end, if (increment > 0) step else -step) } -public fun CharacterSequence.step(step: Int): CharacterSequence { +public fun CharProgression.step(step: Int): CharProgression { checkStepIsPositive(step > 0, step) - return CharacterSequence(start, end, if (increment > 0) step else -step) + return CharProgression(start, end, if (increment > 0) step else -step) } -public fun ByteSequence.step(step: Int): ByteSequence { +public fun ByteProgression.step(step: Int): ByteProgression { checkStepIsPositive(step > 0, step) - return ByteSequence(start, end, if (increment > 0) step else -step) + return ByteProgression(start, end, if (increment > 0) step else -step) } -public fun ShortSequence.step(step: Int): ShortSequence { +public fun ShortProgression.step(step: Int): ShortProgression { checkStepIsPositive(step > 0, step) - return ShortSequence(start, end, if (increment > 0) step else -step) + return ShortProgression(start, end, if (increment > 0) step else -step) } -public fun LongSequence.step(step: Long): LongSequence { +public fun LongProgression.step(step: Long): LongProgression { checkStepIsPositive(step > 0, step) - return LongSequence(start, end, if (increment > 0) step else -step) + return LongProgression(start, end, if (increment > 0) step else -step) } -public fun FloatSequence.step(step: Float): FloatSequence { +public fun FloatProgression.step(step: Float): FloatProgression { checkStepIsPositive(step > 0, step) - return FloatSequence(start, end, if (increment > 0) step else -step) + return FloatProgression(start, end, if (increment > 0) step else -step) } -public fun DoubleSequence.step(step: Double): DoubleSequence { +public fun DoubleProgression.step(step: Double): DoubleProgression { checkStepIsPositive(step > 0, step) - return DoubleSequence(start, end, if (increment > 0) step else -step) + return DoubleProgression(start, end, if (increment > 0) step else -step) } -public fun IntRange.step(step: Int): IntSequence { +public fun IntRange.step(step: Int): IntProgression { checkStepIsPositive(step > 0, step) - return IntSequence(start, end, step) + return IntProgression(start, end, step) } -public fun CharRange.step(step: Int): CharacterSequence { +public fun CharRange.step(step: Int): CharProgression { checkStepIsPositive(step > 0, step) - return CharacterSequence(start, end, step) + return CharProgression(start, end, step) } -public fun ByteRange.step(step: Int): ByteSequence { +public fun ByteRange.step(step: Int): ByteProgression { checkStepIsPositive(step > 0, step) - return ByteSequence(start, end, step) + return ByteProgression(start, end, step) } -public fun ShortRange.step(step: Int): ShortSequence { +public fun ShortRange.step(step: Int): ShortProgression { checkStepIsPositive(step > 0, step) - return ShortSequence(start, end, step) + return ShortProgression(start, end, step) } -public fun LongRange.step(step: Long): LongSequence { +public fun LongRange.step(step: Long): LongProgression { checkStepIsPositive(step > 0, step) - return LongSequence(start, end, step) + return LongProgression(start, end, step) } -public fun FloatRange.step(step: Float): FloatSequence { +public fun FloatRange.step(step: Float): FloatProgression { checkStepIsPositive(step > 0, step) - return FloatSequence(start, end, step) + return FloatProgression(start, end, step) } -public fun DoubleRange.step(step: Double): DoubleSequence { +public fun DoubleRange.step(step: Double): DoubleProgression { checkStepIsPositive(step > 0, step) - return DoubleSequence(start, end, step) + return DoubleProgression(start, end, step) } diff --git a/libraries/stdlib/test/language/RangeIterationTest.kt b/libraries/stdlib/test/language/RangeIterationTest.kt index 1a19067fd89..697c04cbd02 100644 --- a/libraries/stdlib/test/language/RangeIterationTest.kt +++ b/libraries/stdlib/test/language/RangeIterationTest.kt @@ -5,7 +5,7 @@ import org.junit.Test as test public class RangeIterationTest { private fun doTest( - sequence: NumberSequence, + sequence: Progression, expectedStart: N, expectedEnd: N, expectedIncrement: Number, diff --git a/libraries/stdlib/test/language/RangeTest.kt b/libraries/stdlib/test/language/RangeTest.kt index 6de0520ab77..0f5a2f9e4d8 100644 --- a/libraries/stdlib/test/language/RangeTest.kt +++ b/libraries/stdlib/test/language/RangeTest.kt @@ -143,15 +143,15 @@ public class RangeTest { assertFalse("trail" in range) } - test fun illegalSequenceCreation() { - // create sequence explicitly with increment = 0 - failsWith(javaClass()) { IntSequence(0, 5, 0) } - failsWith(javaClass()) { ByteSequence(0, 5, 0) } - failsWith(javaClass()) { ShortSequence(0, 5, 0) } - failsWith(javaClass()) { LongSequence(0, 5, 0) } - failsWith(javaClass()) { CharacterSequence('a', 'z', 0) } - failsWith(javaClass()) { DoubleSequence(0.0, 5.0, 0.0) } - failsWith(javaClass()) { FloatSequence(0.0.toFloat(), 5.0.toFloat(), 0.0.toFloat()) } + test fun illegalProgressionCreation() { + // create Progression explicitly with increment = 0 + failsWith(javaClass()) { IntProgression(0, 5, 0) } + failsWith(javaClass()) { ByteProgression(0, 5, 0) } + failsWith(javaClass()) { ShortProgression(0, 5, 0) } + failsWith(javaClass()) { LongProgression(0, 5, 0) } + failsWith(javaClass()) { CharProgression('a', 'z', 0) } + failsWith(javaClass()) { DoubleProgression(0.0, 5.0, 0.0) } + failsWith(javaClass()) { FloatProgression(0.0.toFloat(), 5.0.toFloat(), 0.0.toFloat()) } failsWith(javaClass()) { 0..5 step 0 } failsWith(javaClass()) { 0.toByte()..5.toByte() step 0 } diff --git a/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateDownTos.kt b/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateDownTos.kt index 2f53d7c7040..8d8a9a99a12 100644 --- a/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateDownTos.kt +++ b/libraries/stdlib/test/org/jetbrains/kotlin/tools/GenerateDownTos.kt @@ -20,7 +20,7 @@ private fun generateDownTos(outputFile: File, header: String) { fun generateDownTo(writer: PrintWriter, fromType: String, toType: String) { val elementType = getMaxType(fromType, toType) - val rangeType = if (elementType == "Char") "CharacterSequence" else elementType + "Sequence" + val progressionType = elementType + "Progression" val fromExpr = if (elementType == fromType) "this" else "this.to$elementType()" val toExpr = if (elementType == toType) "to" else "to.to$elementType()" @@ -32,8 +32,8 @@ private fun generateDownTos(outputFile: File, header: String) { } writer.println(""" -public inline fun $fromType.downTo(to: $toType): $rangeType { - return $rangeType($fromExpr, $toExpr, $incrementExpr) +public inline fun $fromType.downTo(to: $toType): $progressionType { + return $progressionType($fromExpr, $toExpr, $incrementExpr) }""") } diff --git a/runtime/src/jet/ByteSequence.java b/runtime/src/jet/ByteProgression.java similarity index 89% rename from runtime/src/jet/ByteSequence.java rename to runtime/src/jet/ByteProgression.java index e545e8faab1..7a1d133417a 100644 --- a/runtime/src/jet/ByteSequence.java +++ b/runtime/src/jet/ByteProgression.java @@ -19,12 +19,12 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public class ByteSequence implements NumberSequence { +public class ByteProgression implements Progression { private final byte start; private final byte end; private final int increment; - public ByteSequence(byte start, byte end, int increment) { + public ByteProgression(byte start, byte end, int increment) { if (increment == 0) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class ByteSequence implements NumberSequence { @Override public ByteIterator iterator() { - return new ByteSequenceIterator(start, end, increment); + return new ByteProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class ByteSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - ByteSequence bytes = (ByteSequence) o; + ByteProgression bytes = (ByteProgression) o; if (end != bytes.end) return false; if (increment != bytes.increment) return false; diff --git a/runtime/src/jet/ByteSequenceIterator.java b/runtime/src/jet/ByteProgressionIterator.java similarity index 89% rename from runtime/src/jet/ByteSequenceIterator.java rename to runtime/src/jet/ByteProgressionIterator.java index 9abc993a5fa..e2989bc789c 100644 --- a/runtime/src/jet/ByteSequenceIterator.java +++ b/runtime/src/jet/ByteProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class ByteSequenceIterator extends ByteIterator { +class ByteProgressionIterator extends ByteIterator { private byte next; private final byte end; private final int increment; - public ByteSequenceIterator(byte start, byte end, int increment) { + public ByteProgressionIterator(byte start, byte end, int increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/ByteRange.java b/runtime/src/jet/ByteRange.java index f6c2f33ad83..84838c14926 100644 --- a/runtime/src/jet/ByteRange.java +++ b/runtime/src/jet/ByteRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class ByteRange implements Range, NumberSequence { +public final class ByteRange implements Range, Progression { public static final ByteRange EMPTY = new ByteRange((byte) 1, (byte) 0); private final byte start; @@ -56,7 +56,7 @@ public final class ByteRange implements Range, NumberSequence { @Override public ByteIterator iterator() { - return new ByteSequenceIterator(start, end, 1); + return new ByteProgressionIterator(start, end, 1); } @Override diff --git a/runtime/src/jet/CharacterSequence.java b/runtime/src/jet/CharProgression.java similarity index 88% rename from runtime/src/jet/CharacterSequence.java rename to runtime/src/jet/CharProgression.java index afebd919fdb..21f13ad1f86 100644 --- a/runtime/src/jet/CharacterSequence.java +++ b/runtime/src/jet/CharProgression.java @@ -19,12 +19,12 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public class CharacterSequence implements NumberSequence { +public class CharProgression implements Progression { private final char start; private final char end; private final int increment; - public CharacterSequence(char start, char end, int increment) { + public CharProgression(char start, char end, int increment) { if (increment == 0) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class CharacterSequence implements NumberSequence { @Override public CharIterator iterator() { - return new CharacterSequenceIterator(start, end, increment); + return new CharProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class CharacterSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - CharacterSequence that = (CharacterSequence) o; + CharProgression that = (CharProgression) o; if (end != that.end) return false; if (increment != that.increment) return false; diff --git a/runtime/src/jet/CharacterSequenceIterator.java b/runtime/src/jet/CharProgressionIterator.java similarity index 88% rename from runtime/src/jet/CharacterSequenceIterator.java rename to runtime/src/jet/CharProgressionIterator.java index 0f23b279135..49f8dab710f 100644 --- a/runtime/src/jet/CharacterSequenceIterator.java +++ b/runtime/src/jet/CharProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class CharacterSequenceIterator extends CharIterator { +class CharProgressionIterator extends CharIterator { private char next; private final char end; private final int increment; - public CharacterSequenceIterator(char start, char end, int increment) { + public CharProgressionIterator(char start, char end, int increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/CharRange.java b/runtime/src/jet/CharRange.java index ef1b57eeccd..c468ff2511e 100644 --- a/runtime/src/jet/CharRange.java +++ b/runtime/src/jet/CharRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class CharRange implements Range, NumberSequence { +public final class CharRange implements Range, Progression { public static final CharRange EMPTY = new CharRange((char) 1, (char) 0); private final char start; @@ -56,7 +56,7 @@ public final class CharRange implements Range, NumberSequence { +public class DoubleProgression implements Progression { private final double start; private final double end; private final double increment; - public DoubleSequence(double start, double end, double increment) { + public DoubleProgression(double start, double end, double increment) { if (increment == 0.0 || increment == -0.0) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class DoubleSequence implements NumberSequence { @Override public DoubleIterator iterator() { - return new DoubleSequenceIterator(start, end, increment); + return new DoubleProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class DoubleSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - DoubleSequence doubles = (DoubleSequence) o; + DoubleProgression doubles = (DoubleProgression) o; if (Double.compare(doubles.end, end) != 0) return false; if (Double.compare(doubles.increment, increment) != 0) return false; diff --git a/runtime/src/jet/DoubleSequenceIterator.java b/runtime/src/jet/DoubleProgressionIterator.java similarity index 88% rename from runtime/src/jet/DoubleSequenceIterator.java rename to runtime/src/jet/DoubleProgressionIterator.java index 1a7e551e6f8..33de662abec 100644 --- a/runtime/src/jet/DoubleSequenceIterator.java +++ b/runtime/src/jet/DoubleProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class DoubleSequenceIterator extends DoubleIterator { +class DoubleProgressionIterator extends DoubleIterator { private double next; private final double end; private final double increment; - public DoubleSequenceIterator(double start, double end, double increment) { + public DoubleProgressionIterator(double start, double end, double increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/DoubleRange.java b/runtime/src/jet/DoubleRange.java index 96096705abb..57ae10ad9c5 100644 --- a/runtime/src/jet/DoubleRange.java +++ b/runtime/src/jet/DoubleRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class DoubleRange implements Range, NumberSequence { +public final class DoubleRange implements Range, Progression { public static final DoubleRange EMPTY = new DoubleRange(1, 0); private final double start; @@ -56,7 +56,7 @@ public final class DoubleRange implements Range, NumberSequence @Override public DoubleIterator iterator() { - return new DoubleSequenceIterator(start, end, 1.0); + return new DoubleProgressionIterator(start, end, 1.0); } @Override diff --git a/runtime/src/jet/FloatSequence.java b/runtime/src/jet/FloatProgression.java similarity index 89% rename from runtime/src/jet/FloatSequence.java rename to runtime/src/jet/FloatProgression.java index f5dd8d4639b..4d91b7bed32 100644 --- a/runtime/src/jet/FloatSequence.java +++ b/runtime/src/jet/FloatProgression.java @@ -19,12 +19,12 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public class FloatSequence implements NumberSequence { +public class FloatProgression implements Progression { private final float start; private final float end; private final float increment; - public FloatSequence(float start, float end, float increment) { + public FloatProgression(float start, float end, float increment) { if (increment == 0.0f || increment == -0.0f) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class FloatSequence implements NumberSequence { @Override public FloatIterator iterator() { - return new FloatSequenceIterator(start, end, increment); + return new FloatProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class FloatSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - FloatSequence floats = (FloatSequence) o; + FloatProgression floats = (FloatProgression) o; if (Float.compare(floats.end, end) != 0) return false; if (Float.compare(floats.increment, increment) != 0) return false; diff --git a/runtime/src/jet/FloatSequenceIterator.java b/runtime/src/jet/FloatProgressionIterator.java similarity index 88% rename from runtime/src/jet/FloatSequenceIterator.java rename to runtime/src/jet/FloatProgressionIterator.java index 35bfac98c1f..7d30986e9b3 100644 --- a/runtime/src/jet/FloatSequenceIterator.java +++ b/runtime/src/jet/FloatProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class FloatSequenceIterator extends FloatIterator { +class FloatProgressionIterator extends FloatIterator { private float next; private final float end; private final float increment; - public FloatSequenceIterator(float start, float end, float increment) { + public FloatProgressionIterator(float start, float end, float increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/FloatRange.java b/runtime/src/jet/FloatRange.java index 659052a2c63..82d4f163a89 100644 --- a/runtime/src/jet/FloatRange.java +++ b/runtime/src/jet/FloatRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class FloatRange implements Range, NumberSequence { +public final class FloatRange implements Range, Progression { public static final FloatRange EMPTY = new FloatRange(1, 0); private final float start; @@ -56,7 +56,7 @@ public final class FloatRange implements Range, NumberSequence { @Override public FloatIterator iterator() { - return new FloatSequenceIterator(start, end, 1); + return new FloatProgressionIterator(start, end, 1); } @Override diff --git a/runtime/src/jet/IntSequence.java b/runtime/src/jet/IntProgression.java similarity index 89% rename from runtime/src/jet/IntSequence.java rename to runtime/src/jet/IntProgression.java index 88e06657e91..254c962695a 100644 --- a/runtime/src/jet/IntSequence.java +++ b/runtime/src/jet/IntProgression.java @@ -19,12 +19,12 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public class IntSequence implements NumberSequence { +public class IntProgression implements Progression { private final int start; private final int end; private final int increment; - public IntSequence(int start, int end, int increment) { + public IntProgression(int start, int end, int increment) { if (increment == 0) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class IntSequence implements NumberSequence { @Override public IntIterator iterator() { - return new IntSequenceIterator(start, end, increment); + return new IntProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class IntSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - IntSequence sequence = (IntSequence) o; + IntProgression sequence = (IntProgression) o; if (end != sequence.end) return false; if (increment != sequence.increment) return false; diff --git a/runtime/src/jet/IntSequenceIterator.java b/runtime/src/jet/IntProgressionIterator.java similarity index 89% rename from runtime/src/jet/IntSequenceIterator.java rename to runtime/src/jet/IntProgressionIterator.java index 06e8c8e3229..21845098713 100644 --- a/runtime/src/jet/IntSequenceIterator.java +++ b/runtime/src/jet/IntProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class IntSequenceIterator extends IntIterator { +class IntProgressionIterator extends IntIterator { private int next; private final int end; private final int increment; - public IntSequenceIterator(int start, int end, int increment) { + public IntProgressionIterator(int start, int end, int increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/IntRange.java b/runtime/src/jet/IntRange.java index 4e6fa8f6205..f399d73ec83 100644 --- a/runtime/src/jet/IntRange.java +++ b/runtime/src/jet/IntRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class IntRange implements Range, NumberSequence { +public final class IntRange implements Range, Progression { public static final IntRange EMPTY = new IntRange(1, 0); private final int start; @@ -56,7 +56,7 @@ public final class IntRange implements Range, NumberSequence { @Override public IntIterator iterator() { - return new IntSequenceIterator(start, end, 1); + return new IntProgressionIterator(start, end, 1); } @Override diff --git a/runtime/src/jet/LongSequence.java b/runtime/src/jet/LongProgression.java similarity index 89% rename from runtime/src/jet/LongSequence.java rename to runtime/src/jet/LongProgression.java index 217884fe624..73387a87a09 100644 --- a/runtime/src/jet/LongSequence.java +++ b/runtime/src/jet/LongProgression.java @@ -19,12 +19,12 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public class LongSequence implements NumberSequence { +public class LongProgression implements Progression { private final long start; private final long end; private final long increment; - public LongSequence(long start, long end, long increment) { + public LongProgression(long start, long end, long increment) { if (increment == 0) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class LongSequence implements NumberSequence { @Override public LongIterator iterator() { - return new LongSequenceIterator(start, end, increment); + return new LongProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class LongSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - LongSequence longs = (LongSequence) o; + LongProgression longs = (LongProgression) o; if (end != longs.end) return false; if (increment != longs.increment) return false; diff --git a/runtime/src/jet/LongSequenceIterator.java b/runtime/src/jet/LongProgressionIterator.java similarity index 88% rename from runtime/src/jet/LongSequenceIterator.java rename to runtime/src/jet/LongProgressionIterator.java index dd63d0c62fa..71fc911794d 100644 --- a/runtime/src/jet/LongSequenceIterator.java +++ b/runtime/src/jet/LongProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class LongSequenceIterator extends LongIterator { +class LongProgressionIterator extends LongIterator { private long next; private final long end; private final long increment; - public LongSequenceIterator(long start, long end, long increment) { + public LongProgressionIterator(long start, long end, long increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/LongRange.java b/runtime/src/jet/LongRange.java index 9432e5833b8..cebf689b652 100644 --- a/runtime/src/jet/LongRange.java +++ b/runtime/src/jet/LongRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class LongRange implements Range, NumberSequence { +public final class LongRange implements Range, Progression { public static final LongRange EMPTY = new LongRange(1, 0); private final long start; @@ -56,7 +56,7 @@ public final class LongRange implements Range, NumberSequence { @Override public LongIterator iterator() { - return new LongSequenceIterator(start, end, 1); + return new LongProgressionIterator(start, end, 1); } @Override diff --git a/runtime/src/jet/NumberSequence.java b/runtime/src/jet/Progression.java similarity index 93% rename from runtime/src/jet/NumberSequence.java rename to runtime/src/jet/Progression.java index 09c06b8e3f4..b54fe7b29f7 100644 --- a/runtime/src/jet/NumberSequence.java +++ b/runtime/src/jet/Progression.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public interface NumberSequence extends Iterable { +public interface Progression extends Iterable { N getStart(); N getEnd(); Number getIncrement(); diff --git a/runtime/src/jet/ShortSequence.java b/runtime/src/jet/ShortProgression.java similarity index 89% rename from runtime/src/jet/ShortSequence.java rename to runtime/src/jet/ShortProgression.java index 30b3e79a382..1dece308400 100644 --- a/runtime/src/jet/ShortSequence.java +++ b/runtime/src/jet/ShortProgression.java @@ -19,12 +19,12 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public class ShortSequence implements NumberSequence { +public class ShortProgression implements Progression { private final short start; private final short end; private final int increment; - public ShortSequence(short start, short end, int increment) { + public ShortProgression(short start, short end, int increment) { if (increment == 0) { throw new IllegalArgumentException("Increment must be non-zero: " + increment); } @@ -50,7 +50,7 @@ public class ShortSequence implements NumberSequence { @Override public ShortIterator iterator() { - return new ShortSequenceIterator(start, end, increment); + return new ShortProgressionIterator(start, end, increment); } @Override @@ -68,7 +68,7 @@ public class ShortSequence implements NumberSequence { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - ShortSequence shorts = (ShortSequence) o; + ShortProgression shorts = (ShortProgression) o; if (end != shorts.end) return false; if (increment != shorts.increment) return false; diff --git a/runtime/src/jet/ShortSequenceIterator.java b/runtime/src/jet/ShortProgressionIterator.java similarity index 88% rename from runtime/src/jet/ShortSequenceIterator.java rename to runtime/src/jet/ShortProgressionIterator.java index 23ec58f15bc..3b7bf8cf4f5 100644 --- a/runtime/src/jet/ShortSequenceIterator.java +++ b/runtime/src/jet/ShortProgressionIterator.java @@ -16,12 +16,12 @@ package jet; -class ShortSequenceIterator extends ShortIterator { +class ShortProgressionIterator extends ShortIterator { private short next; private final short end; private final int increment; - public ShortSequenceIterator(short start, short end, int increment) { + public ShortProgressionIterator(short start, short end, int increment) { this.next = start; this.end = end; this.increment = increment; diff --git a/runtime/src/jet/ShortRange.java b/runtime/src/jet/ShortRange.java index fada8d87149..4e26622db58 100644 --- a/runtime/src/jet/ShortRange.java +++ b/runtime/src/jet/ShortRange.java @@ -19,7 +19,7 @@ package jet; import org.jetbrains.jet.rt.annotation.AssertInvisibleInResolver; @AssertInvisibleInResolver -public final class ShortRange implements Range, NumberSequence { +public final class ShortRange implements Range, Progression { public static final ShortRange EMPTY = new ShortRange((short) 1, (short) 0); private final short start; @@ -56,7 +56,7 @@ public final class ShortRange implements Range, NumberSequence { @Override public ShortIterator iterator() { - return new ShortSequenceIterator(start, end, 1); + return new ShortProgressionIterator(start, end, 1); } @Override