Removed upto() and downto() member functions from number types
#KT-2519 fixed
This commit is contained in:
@@ -44,8 +44,7 @@ public class IntrinsicMethods {
|
||||
private static final IntrinsicMethod UNARY_PLUS = new UnaryPlus();
|
||||
private static final IntrinsicMethod NUMBER_CAST = new NumberCast();
|
||||
private static final IntrinsicMethod INV = new Inv();
|
||||
private static final IntrinsicMethod UP_TO = new UpTo(true);
|
||||
private static final IntrinsicMethod DOWN_TO = new UpTo(false);
|
||||
private static final IntrinsicMethod RANGE_TO = new RangeTo();
|
||||
private static final IntrinsicMethod INC = new Increment(1);
|
||||
private static final IntrinsicMethod DEC = new Increment(-1);
|
||||
private static final IntrinsicMethod HASH_CODE = new HashCode();
|
||||
@@ -93,9 +92,7 @@ public class IntrinsicMethods {
|
||||
declareIntrinsicFunction(type, Name.identifier("plus"), 0, UNARY_PLUS);
|
||||
declareIntrinsicFunction(type, Name.identifier("minus"), 0, UNARY_MINUS);
|
||||
declareIntrinsicFunction(type, Name.identifier("inv"), 0, INV);
|
||||
declareIntrinsicFunction(type, Name.identifier("rangeTo"), 1, UP_TO);
|
||||
declareIntrinsicFunction(type, Name.identifier("upto"), 1, UP_TO);
|
||||
declareIntrinsicFunction(type, Name.identifier("downto"), 1, DOWN_TO);
|
||||
declareIntrinsicFunction(type, Name.identifier("rangeTo"), 1, RANGE_TO);
|
||||
declareIntrinsicFunction(type, Name.identifier("inc"), 0, INC);
|
||||
declareIntrinsicFunction(type, Name.identifier("dec"), 0, DEC);
|
||||
declareIntrinsicFunction(type, Name.identifier("hashCode"), 0, HASH_CODE);
|
||||
|
||||
+4
-6
@@ -32,11 +32,9 @@ import java.util.List;
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
*/
|
||||
public class UpTo implements IntrinsicMethod {
|
||||
private boolean forward;
|
||||
public class RangeTo implements IntrinsicMethod {
|
||||
|
||||
public UpTo(boolean forward) {
|
||||
this.forward = forward;
|
||||
public RangeTo() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +44,7 @@ public class UpTo implements IntrinsicMethod {
|
||||
final Type rightType = codegen.expressionType(arguments.get(0));
|
||||
receiver.put(Type.INT_TYPE, v);
|
||||
codegen.gen(arguments.get(0), rightType);
|
||||
v.invokestatic("jet/runtime/Ranges", forward ? "upTo" : "downTo", "(" + receiver.type.getDescriptor() + leftType.getDescriptor() + ")" + expectedType.getDescriptor());
|
||||
v.invokestatic("jet/runtime/Ranges", "rangeTo", "(" + receiver.type.getDescriptor() + leftType.getDescriptor() + ")" + expectedType.getDescriptor());
|
||||
return StackValue.onStack(expectedType);
|
||||
}
|
||||
else {
|
||||
@@ -56,7 +54,7 @@ public class UpTo implements IntrinsicMethod {
|
||||
// if (JetTypeMapper.isIntPrimitive(leftType)) {
|
||||
codegen.gen(expression.getLeft(), leftType);
|
||||
codegen.gen(expression.getRight(), rightType);
|
||||
v.invokestatic("jet/runtime/Ranges", forward ? "upTo" : "downTo", "(" + leftType.getDescriptor() + rightType.getDescriptor() + ")" + expectedType.getDescriptor());
|
||||
v.invokestatic("jet/runtime/Ranges", "rangeTo", "(" + leftType.getDescriptor() + rightType.getDescriptor() + ")" + expectedType.getDescriptor());
|
||||
return StackValue.onStack(expectedType);
|
||||
// }
|
||||
// else {
|
||||
@@ -73,22 +73,6 @@ public class Double : Number, Comparable<Double> {
|
||||
public fun rangeTo(other : Byte) : DoubleRange
|
||||
public fun rangeTo(other : Char) : DoubleRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : DoubleRange
|
||||
public fun upto(other : Long) : DoubleRange
|
||||
public fun upto(other : Int) : DoubleRange
|
||||
public fun upto(other : Short) : DoubleRange
|
||||
public fun upto(other : Byte) : DoubleRange
|
||||
public fun upto(other : Char) : DoubleRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : DoubleRange
|
||||
public fun downto(other : Long) : DoubleRange
|
||||
public fun downto(other : Int) : DoubleRange
|
||||
public fun downto(other : Short) : DoubleRange
|
||||
public fun downto(other : Byte) : DoubleRange
|
||||
public fun downto(other : Char) : DoubleRange
|
||||
|
||||
public fun inc() : Double
|
||||
public fun dec() : Double
|
||||
public fun plus() : Double
|
||||
@@ -163,22 +147,6 @@ public class Float : Number, Comparable<Float> {
|
||||
public fun rangeTo(other : Byte) : FloatRange
|
||||
public fun rangeTo(other : Char) : FloatRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : FloatRange
|
||||
public fun upto(other : Long) : DoubleRange
|
||||
public fun upto(other : Int) : FloatRange
|
||||
public fun upto(other : Short) : FloatRange
|
||||
public fun upto(other : Byte) : FloatRange
|
||||
public fun upto(other : Char) : FloatRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : FloatRange
|
||||
public fun downto(other : Long) : DoubleRange
|
||||
public fun downto(other : Int) : FloatRange
|
||||
public fun downto(other : Short) : FloatRange
|
||||
public fun downto(other : Byte) : FloatRange
|
||||
public fun downto(other : Char) : FloatRange
|
||||
|
||||
public fun inc() : Float
|
||||
public fun dec() : Float
|
||||
public fun plus() : Float
|
||||
@@ -253,22 +221,6 @@ public class Long : Number, Comparable<Long> {
|
||||
public fun rangeTo(other : Byte) : LongRange
|
||||
public fun rangeTo(other : Char) : LongRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : FloatRange
|
||||
public fun upto(other : Long) : LongRange
|
||||
public fun upto(other : Int) : LongRange
|
||||
public fun upto(other : Short) : LongRange
|
||||
public fun upto(other : Byte) : LongRange
|
||||
public fun upto(other : Char) : LongRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : FloatRange
|
||||
public fun downto(other : Long) : LongRange
|
||||
public fun downto(other : Int) : LongRange
|
||||
public fun downto(other : Short) : LongRange
|
||||
public fun downto(other : Byte) : LongRange
|
||||
public fun downto(other : Char) : LongRange
|
||||
|
||||
public fun inc() : Long
|
||||
public fun dec() : Long
|
||||
public fun plus() : Long
|
||||
@@ -351,22 +303,6 @@ public class Int : Number, Comparable<Int> {
|
||||
public fun rangeTo(other : Byte) : IntRange
|
||||
public fun rangeTo(other : Char) : IntRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : FloatRange
|
||||
public fun upto(other : Long) : LongRange
|
||||
public fun upto(other : Int) : IntRange
|
||||
public fun upto(other : Short) : IntRange
|
||||
public fun upto(other : Byte) : IntRange
|
||||
public fun upto(other : Char) : IntRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : FloatRange
|
||||
public fun downto(other : Long) : LongRange
|
||||
public fun downto(other : Int) : IntRange
|
||||
public fun downto(other : Short) : IntRange
|
||||
public fun downto(other : Byte) : IntRange
|
||||
public fun downto(other : Char) : IntRange
|
||||
|
||||
public fun inc() : Int
|
||||
public fun dec() : Int
|
||||
public fun plus() : Int
|
||||
@@ -449,22 +385,6 @@ public class Char : Number, Comparable<Char> {
|
||||
public fun rangeTo(other : Byte) : CharRange
|
||||
public fun rangeTo(other : Char) : CharRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : FloatRange
|
||||
public fun upto(other : Long) : LongRange
|
||||
public fun upto(other : Int) : IntRange
|
||||
public fun upto(other : Short) : ShortRange
|
||||
public fun upto(other : Byte) : CharRange
|
||||
public fun upto(other : Char) : CharRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : FloatRange
|
||||
public fun downto(other : Long) : LongRange
|
||||
public fun downto(other : Int) : IntRange
|
||||
public fun downto(other : Short) : ShortRange
|
||||
public fun downto(other : Byte) : CharRange
|
||||
public fun downto(other : Char) : CharRange
|
||||
|
||||
public fun inc() : Char
|
||||
public fun dec() : Char
|
||||
public fun plus() : Int
|
||||
@@ -539,22 +459,6 @@ public class Short : Number, Comparable<Short> {
|
||||
public fun rangeTo(other : Byte) : ShortRange
|
||||
public fun rangeTo(other : Char) : ShortRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : FloatRange
|
||||
public fun upto(other : Long) : LongRange
|
||||
public fun upto(other : Int) : IntRange
|
||||
public fun upto(other : Short) : ShortRange
|
||||
public fun upto(other : Byte) : ShortRange
|
||||
public fun upto(other : Char) : ShortRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : FloatRange
|
||||
public fun downto(other : Long) : LongRange
|
||||
public fun downto(other : Int) : IntRange
|
||||
public fun downto(other : Short) : ShortRange
|
||||
public fun downto(other : Byte) : ShortRange
|
||||
public fun downto(other : Char) : ShortRange
|
||||
|
||||
public fun inc() : Short
|
||||
public fun dec() : Short
|
||||
public fun plus() : Short
|
||||
@@ -629,22 +533,6 @@ public class Byte : Number, Comparable<Byte> {
|
||||
public fun rangeTo(other : Byte) : ByteRange
|
||||
public fun rangeTo(other : Char) : CharRange
|
||||
|
||||
public fun upto(other : Double) : DoubleRange
|
||||
public fun upto(other : Float) : FloatRange
|
||||
public fun upto(other : Long) : LongRange
|
||||
public fun upto(other : Int) : IntRange
|
||||
public fun upto(other : Short) : ShortRange
|
||||
public fun upto(other : Byte) : ByteRange
|
||||
public fun upto(other : Char) : CharRange
|
||||
|
||||
public fun downto(other : Double) : DoubleRange
|
||||
public fun downto(other : Float) : FloatRange
|
||||
public fun downto(other : Long) : LongRange
|
||||
public fun downto(other : Int) : IntRange
|
||||
public fun downto(other : Short) : ShortRange
|
||||
public fun downto(other : Byte) : ByteRange
|
||||
public fun downto(other : Char) : CharRange
|
||||
|
||||
public fun inc() : Byte
|
||||
public fun dec() : Byte
|
||||
public fun plus() : Byte
|
||||
|
||||
@@ -54,13 +54,6 @@ public final class jet.Byte : jet.Number, jet.Comparable<jet.Byte> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Int
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Long
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Int
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.ByteRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.CharRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.ShortRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Byte
|
||||
@@ -108,13 +101,6 @@ public final class jet.Byte : jet.Number, jet.Comparable<jet.Byte> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.ByteRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.CharRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.ShortRange
|
||||
}
|
||||
public final class jet.ByteArray : jet.Any {
|
||||
public final /*constructor*/ fun <init>(/*0*/ size: jet.Int): jet.ByteArray
|
||||
@@ -161,13 +147,6 @@ public final class jet.Char : jet.Number, jet.Comparable<jet.Char> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Int
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Long
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Int
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.CharRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.CharRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.ShortRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Char
|
||||
@@ -212,13 +191,6 @@ public final class jet.Char : jet.Number, jet.Comparable<jet.Char> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.CharRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.CharRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.ShortRange
|
||||
}
|
||||
public final class jet.CharArray : jet.Any {
|
||||
public final /*constructor*/ fun <init>(/*0*/ size: jet.Int): jet.CharArray
|
||||
@@ -274,13 +246,6 @@ public final class jet.Double : jet.Number, jet.Comparable<jet.Double> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Double
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Double
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Double
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.DoubleRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Double
|
||||
@@ -327,13 +292,6 @@ public final class jet.Double : jet.Number, jet.Comparable<jet.Double> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.DoubleRange
|
||||
}
|
||||
public final class jet.DoubleArray : jet.Any {
|
||||
public final /*constructor*/ fun <init>(/*0*/ size: jet.Int): jet.DoubleArray
|
||||
@@ -471,13 +429,6 @@ public final class jet.Float : jet.Number, jet.Comparable<jet.Float> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Float
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Float
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Float
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.FloatRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Float
|
||||
@@ -525,13 +476,6 @@ public final class jet.Float : jet.Number, jet.Comparable<jet.Float> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.FloatRange
|
||||
}
|
||||
public final class jet.FloatArray : jet.Any {
|
||||
public final /*constructor*/ fun <init>(/*0*/ size: jet.Int): jet.FloatArray
|
||||
@@ -674,13 +618,6 @@ public final class jet.Int : jet.Number, jet.Comparable<jet.Int> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Int
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Long
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Int
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.IntRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.IntRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.IntRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Int
|
||||
@@ -732,13 +669,6 @@ public final class jet.Int : jet.Number, jet.Comparable<jet.Int> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.IntRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.IntRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.IntRange
|
||||
public final fun ushr(/*0*/ bits: jet.Int): jet.Int
|
||||
public final fun xor(/*0*/ other: jet.Int): jet.Int
|
||||
}
|
||||
@@ -796,13 +726,6 @@ public final class jet.Long : jet.Number, jet.Comparable<jet.Long> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Long
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Long
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Long
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.LongRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Long
|
||||
@@ -854,13 +777,6 @@ public final class jet.Long : jet.Number, jet.Comparable<jet.Long> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.LongRange
|
||||
public final fun ushr(/*0*/ bits: jet.Int): jet.Long
|
||||
public final fun xor(/*0*/ other: jet.Long): jet.Long
|
||||
}
|
||||
@@ -928,13 +844,6 @@ public final class jet.Short : jet.Number, jet.Comparable<jet.Short> {
|
||||
public final fun div(/*0*/ other: jet.Int): jet.Int
|
||||
public final fun div(/*0*/ other: jet.Long): jet.Long
|
||||
public final fun div(/*0*/ other: jet.Short): jet.Int
|
||||
public final fun downto(/*0*/ other: jet.Byte): jet.ShortRange
|
||||
public final fun downto(/*0*/ other: jet.Char): jet.ShortRange
|
||||
public final fun downto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun downto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun downto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun downto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun downto(/*0*/ other: jet.Short): jet.ShortRange
|
||||
public open override /*1*/ fun equals(/*0*/ other: jet.Any?): jet.Boolean
|
||||
public open override /*1*/ fun hashCode(): jet.Int
|
||||
public final fun inc(): jet.Short
|
||||
@@ -982,13 +891,6 @@ public final class jet.Short : jet.Number, jet.Comparable<jet.Short> {
|
||||
public open override /*1*/ fun toInt(): jet.Int
|
||||
public open override /*1*/ fun toLong(): jet.Long
|
||||
public open override /*1*/ fun toShort(): jet.Short
|
||||
public final fun upto(/*0*/ other: jet.Byte): jet.ShortRange
|
||||
public final fun upto(/*0*/ other: jet.Char): jet.ShortRange
|
||||
public final fun upto(/*0*/ other: jet.Double): jet.DoubleRange
|
||||
public final fun upto(/*0*/ other: jet.Float): jet.FloatRange
|
||||
public final fun upto(/*0*/ other: jet.Int): jet.IntRange
|
||||
public final fun upto(/*0*/ other: jet.Long): jet.LongRange
|
||||
public final fun upto(/*0*/ other: jet.Short): jet.ShortRange
|
||||
}
|
||||
public final class jet.ShortArray : jet.Any {
|
||||
public final /*constructor*/ fun <init>(/*0*/ size: jet.Int): jet.ShortArray
|
||||
|
||||
-1
@@ -50,7 +50,6 @@ public final class FunctionIntrinsics {
|
||||
register(ArrayFIF.INSTANCE);
|
||||
register(TopLevelFIF.INSTANCE);
|
||||
register(NumberConversionFIF.INSTANCE);
|
||||
register(RangesFIF.INSTANCE);
|
||||
}
|
||||
|
||||
private void register(@NotNull FunctionIntrinsicFactory instance) {
|
||||
|
||||
-36
@@ -1,36 +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 org.jetbrains.k2js.translate.intrinsic.functions.factories;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.translate.intrinsic.functions.basic.CallStandardMethodIntrinsic;
|
||||
|
||||
import static org.jetbrains.k2js.translate.intrinsic.functions.patterns.PatternBuilder.pattern;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public final class RangesFIF extends CompositeFIF {
|
||||
|
||||
@NotNull
|
||||
public static final FunctionIntrinsicFactory INSTANCE = new RangesFIF();
|
||||
|
||||
private RangesFIF() {
|
||||
add(pattern("Int.upto"), new CallStandardMethodIntrinsic("Kotlin.intUpto", true, 1));
|
||||
add(pattern("Int.downto"), new CallStandardMethodIntrinsic("Kotlin.intDownto", true, 1));
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class Ranges {
|
||||
private Ranges() {
|
||||
}
|
||||
|
||||
public static ByteRange upTo(byte from, byte to) {
|
||||
public static ByteRange rangeTo(byte from, byte to) {
|
||||
if (from > to) {
|
||||
return ByteRange.empty;
|
||||
}
|
||||
@@ -37,16 +37,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static ByteRange downTo(byte from, byte to) {
|
||||
if (from >= to) {
|
||||
return new ByteRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return ByteRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange upTo(byte from, short to) {
|
||||
public static ShortRange rangeTo(byte from, short to) {
|
||||
if (from > to) {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
@@ -55,16 +46,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange downTo(byte from, short to) {
|
||||
if (from >= to) {
|
||||
return new ShortRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange upTo(byte from, int to) {
|
||||
public static IntRange rangeTo(byte from, int to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -73,16 +55,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(byte from, int to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(byte from, long to) {
|
||||
public static LongRange rangeTo(byte from, long to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -91,32 +64,15 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(byte from, long to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatRange upTo(byte from, float to) {
|
||||
public static FloatRange rangeTo(byte from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(byte from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(byte from, double to) {
|
||||
public static DoubleRange rangeTo(byte from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(byte from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static CharRange upTo(byte from, char to) {
|
||||
public static CharRange rangeTo(byte from, char to) {
|
||||
if (from > to) {
|
||||
return CharRange.empty;
|
||||
}
|
||||
@@ -125,16 +81,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static CharRange downTo(byte from, char to) {
|
||||
if (from >= to) {
|
||||
return new CharRange((char) from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return CharRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange upTo(short from, byte to) {
|
||||
public static ShortRange rangeTo(short from, byte to) {
|
||||
if (from > to) {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
@@ -143,16 +90,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange downTo(short from, byte to) {
|
||||
if (from >= to) {
|
||||
return new ShortRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange upTo(short from, short to) {
|
||||
public static ShortRange rangeTo(short from, short to) {
|
||||
if (from > to) {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
@@ -161,16 +99,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange downTo(short from, short to) {
|
||||
if (from >= to) {
|
||||
return new ShortRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange upTo(short from, int to) {
|
||||
public static IntRange rangeTo(short from, int to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -179,16 +108,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(short from, int to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(short from, long to) {
|
||||
public static LongRange rangeTo(short from, long to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -197,32 +117,15 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(short from, long to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatRange upTo(short from, float to) {
|
||||
public static FloatRange rangeTo(short from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(short from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(short from, double to) {
|
||||
public static DoubleRange rangeTo(short from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(short from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static ShortRange upTo(short from, char to) {
|
||||
public static ShortRange rangeTo(short from, char to) {
|
||||
if (from > to) {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
@@ -231,16 +134,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange downTo(short from, char to) {
|
||||
if (from >= to) {
|
||||
return new ShortRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange upTo(int from, byte to) {
|
||||
public static IntRange rangeTo(int from, byte to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -249,16 +143,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(int from, byte to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange upTo(int from, short to) {
|
||||
public static IntRange rangeTo(int from, short to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -267,16 +152,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(int from, short to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange upTo(int from, int to) {
|
||||
public static IntRange rangeTo(int from, int to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -285,16 +161,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(int from, int to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(int from, long to) {
|
||||
public static LongRange rangeTo(int from, long to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -303,32 +170,15 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(int from, long to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatRange upTo(int from, float to) {
|
||||
public static FloatRange rangeTo(int from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(int from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(int from, double to) {
|
||||
public static DoubleRange rangeTo(int from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(int from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static IntRange upTo(int from, char to) {
|
||||
public static IntRange rangeTo(int from, char to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -337,16 +187,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(int from, char to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(long from, byte to) {
|
||||
public static LongRange rangeTo(long from, byte to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -355,16 +196,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(long from, byte to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(long from, short to) {
|
||||
public static LongRange rangeTo(long from, short to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -373,16 +205,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(long from, short to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(long from, int to) {
|
||||
public static LongRange rangeTo(long from, int to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -391,16 +214,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(long from, int to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(long from, long to) {
|
||||
public static LongRange rangeTo(long from, long to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -409,32 +223,15 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(long from, long to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatRange upTo(long from, float to) {
|
||||
public static FloatRange rangeTo(long from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(long from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(long from, double to) {
|
||||
public static DoubleRange rangeTo(long from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(long from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static LongRange upTo(long from, char to) {
|
||||
public static LongRange rangeTo(long from, char to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -443,128 +240,63 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(long from, char to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatRange upTo(float from, byte to) {
|
||||
public static FloatRange rangeTo(float from, byte to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(float from, byte to) {
|
||||
public static FloatRange rangeTo(float from, short to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange upTo(float from, short to) {
|
||||
public static FloatRange rangeTo(float from, int to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(float from, short to) {
|
||||
public static FloatRange rangeTo(float from, long to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange upTo(float from, int to) {
|
||||
public static FloatRange rangeTo(float from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(float from, int to) {
|
||||
public static DoubleRange rangeTo(float from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange rangeTo(float from, char to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange upTo(float from, long to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(float from, long to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange upTo(float from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(float from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(float from, double to) {
|
||||
public static DoubleRange rangeTo(double from, byte to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(float from, double to) {
|
||||
public static DoubleRange rangeTo(double from, short to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange upTo(float from, char to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(float from, char to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, byte to) {
|
||||
public static DoubleRange rangeTo(double from, int to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, byte to) {
|
||||
public static DoubleRange rangeTo(double from, long to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, short to) {
|
||||
public static DoubleRange rangeTo(double from, float to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, short to) {
|
||||
public static DoubleRange rangeTo(double from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, int to) {
|
||||
public static DoubleRange rangeTo(double from, char to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, int to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, long to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, long to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, float to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, float to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(double from, char to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(double from, char to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static CharRange upTo(char from, byte to) {
|
||||
public static CharRange rangeTo(char from, byte to) {
|
||||
if (from > to) {
|
||||
return CharRange.empty;
|
||||
}
|
||||
@@ -573,16 +305,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static CharRange downTo(char from, byte to) {
|
||||
if (from >= to) {
|
||||
return new CharRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return CharRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange upTo(char from, short to) {
|
||||
public static ShortRange rangeTo(char from, short to) {
|
||||
if (from > to) {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
@@ -591,16 +314,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static ShortRange downTo(char from, short to) {
|
||||
if (from >= to) {
|
||||
return new ShortRange((short) from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return ShortRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange upTo(char from, int to) {
|
||||
public static IntRange rangeTo(char from, int to) {
|
||||
if (from > to) {
|
||||
return IntRange.empty;
|
||||
}
|
||||
@@ -609,16 +323,7 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static IntRange downTo(char from, int to) {
|
||||
if (from >= to) {
|
||||
return new IntRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return IntRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange upTo(char from, long to) {
|
||||
public static LongRange rangeTo(char from, long to) {
|
||||
if (from > to) {
|
||||
return LongRange.empty;
|
||||
}
|
||||
@@ -627,32 +332,15 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static LongRange downTo(char from, long to) {
|
||||
if (from >= to) {
|
||||
return new LongRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return LongRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static FloatRange upTo(char from, float to) {
|
||||
public static FloatRange rangeTo(char from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static FloatRange downTo(char from, float to) {
|
||||
return new FloatRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange upTo(char from, double to) {
|
||||
public static DoubleRange rangeTo(char from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static DoubleRange downTo(char from, double to) {
|
||||
return new DoubleRange(from, to - from);
|
||||
}
|
||||
|
||||
public static CharRange upTo(char from, char to) {
|
||||
public static CharRange rangeTo(char from, char to) {
|
||||
if (from > to) {
|
||||
return CharRange.empty;
|
||||
}
|
||||
@@ -661,15 +349,6 @@ public class Ranges {
|
||||
}
|
||||
}
|
||||
|
||||
public static CharRange downTo(char from, char to) {
|
||||
if (from >= to) {
|
||||
return new CharRange(from, to - from - 1);
|
||||
}
|
||||
else {
|
||||
return CharRange.empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> strings = Arrays.asList("byte", "short", "int", "long", "float", "double", "char");
|
||||
for (String t1 : strings) {
|
||||
@@ -698,15 +377,12 @@ public class Ranges {
|
||||
}
|
||||
|
||||
if (resType.equals("FloatRange") || resType.equals("DoubleRange")) {
|
||||
System.out.println("\npublic static " + resType + " upTo(" + t1 + " from, " + t2 + " to) {\n" +
|
||||
" return new " + resType + "(from, to-from);\n" +
|
||||
"}");
|
||||
System.out.println("\npublic static " + resType + " downTo(" + t1 + " from, " + t2 + " to) {\n" +
|
||||
System.out.println("\npublic static " + resType + " rangeTo(" + t1 + " from, " + t2 + " to) {\n" +
|
||||
" return new " + resType + "(from, to-from);\n" +
|
||||
"}");
|
||||
}
|
||||
else {
|
||||
System.out.println("\npublic static " + resType + " upTo(" + t1 + " from, " + t2 + " to) {" +
|
||||
System.out.println("\npublic static " + resType + " rangeTo(" + t1 + " from, " + t2 + " to) {" +
|
||||
"\n if(from > to) {\n" +
|
||||
" return " + resType + ".empty;\n" +
|
||||
" }\n" +
|
||||
@@ -714,14 +390,6 @@ public class Ranges {
|
||||
" return new " + resType + "(from, to-from+1);\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
System.out.println("\npublic static " + resType + " downTo(" + t1 + " from, " + t2 + " to) {" +
|
||||
"\n if(from >= to) {\n" +
|
||||
" return new " + resType + "(from, to-from-1);\n" +
|
||||
" }\n" +
|
||||
" else {\n" +
|
||||
" return " + resType + ".empty;\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user