generate the code of Numbers.kt
This commit is contained in:
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2015 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 kotlin
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Superclass for all platform classes representing numeric values.
|
||||||
|
*/
|
||||||
|
public abstract class Number {
|
||||||
|
/**
|
||||||
|
* Returns the value of this number as a [Double], which may involve rounding.
|
||||||
|
*/
|
||||||
|
public abstract fun toDouble(): Double
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of this number as a [Float], which may involve rounding.
|
||||||
|
*/
|
||||||
|
public abstract fun toFloat(): Float
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of this number as a [Long], which may involve rounding or truncation.
|
||||||
|
*/
|
||||||
|
public abstract fun toLong(): Long
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of this number as an [Int], which may involve rounding or truncation.
|
||||||
|
*/
|
||||||
|
public abstract fun toInt(): Int
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
|
||||||
|
*/
|
||||||
|
public abstract fun toChar(): Char
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of this number as a [Short], which may involve rounding or truncation.
|
||||||
|
*/
|
||||||
|
public abstract fun toShort(): Short
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of this number as a [Byte], which may involve rounding or truncation.
|
||||||
|
*/
|
||||||
|
public abstract fun toByte(): Byte
|
||||||
|
}
|
||||||
|
|
||||||
@@ -14,354 +14,232 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Auto-generated file. DO NOT EDIT!
|
||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Superclass for all platform classes representing numeric values.
|
* Represents a 8-bit signed integer.
|
||||||
|
* On the JVM, non-nullable values of this type are represented as values of the primitive type `byte`.
|
||||||
*/
|
*/
|
||||||
public abstract class Number {
|
public class Byte private () : Number, Comparable<Byte> {
|
||||||
/**
|
|
||||||
* Returns the value of this number as a [Double], which may involve rounding.
|
|
||||||
*/
|
|
||||||
public abstract fun toDouble(): Double
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of this number as a [Float], which may involve rounding.
|
|
||||||
*/
|
|
||||||
public abstract fun toFloat(): Float
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of this number as a [Long], which may involve rounding or truncation.
|
|
||||||
*/
|
|
||||||
public abstract fun toLong(): Long
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of this number as an [Int], which may involve rounding or truncation.
|
|
||||||
*/
|
|
||||||
public abstract fun toInt(): Int
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the [Char] with the numeric value equal to this number, truncated to 16 bits if appropriate.
|
|
||||||
*/
|
|
||||||
public abstract fun toChar(): Char
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of this number as a [Short], which may involve rounding or truncation.
|
|
||||||
*/
|
|
||||||
public abstract fun toShort(): Short
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the value of this number as a [Byte], which may involve rounding or truncation.
|
|
||||||
*/
|
|
||||||
public abstract fun toByte(): Byte
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a double-precision 64-bit IEEE 754 floating point number. On the JVM, non-nullable
|
|
||||||
* values of this type are represented as values of the primitive type `double`.
|
|
||||||
*/
|
|
||||||
public class Double private () : Number, Comparable<Double> {
|
|
||||||
class object : FloatingPointConstants<Double> {}
|
|
||||||
|
|
||||||
public override fun compareTo(other: Double): Int
|
|
||||||
public fun compareTo(other: Float): Int
|
|
||||||
public fun compareTo(other: Long) : Int
|
|
||||||
public fun compareTo(other: Int) : Int
|
|
||||||
public fun compareTo(other: Short): Int
|
|
||||||
public fun compareTo(other: Byte) : Int
|
|
||||||
public fun compareTo(other: Char) : Int
|
|
||||||
|
|
||||||
public fun plus(other: Double): Double
|
|
||||||
public fun plus(other: Float) : Double
|
|
||||||
public fun plus(other: Long) : Double
|
|
||||||
public fun plus(other: Int) : Double
|
|
||||||
public fun plus(other: Short) : Double
|
|
||||||
public fun plus(other: Byte) : Double
|
|
||||||
public fun plus(other: Char) : Double
|
|
||||||
|
|
||||||
public fun minus(other: Double): Double
|
|
||||||
public fun minus(other: Float) : Double
|
|
||||||
public fun minus(other: Long) : Double
|
|
||||||
public fun minus(other: Int) : Double
|
|
||||||
public fun minus(other: Short) : Double
|
|
||||||
public fun minus(other: Byte) : Double
|
|
||||||
public fun minus(other: Char) : Double
|
|
||||||
|
|
||||||
public fun times(other: Double): Double
|
|
||||||
public fun times(other: Float) : Double
|
|
||||||
public fun times(other: Long) : Double
|
|
||||||
public fun times(other: Int) : Double
|
|
||||||
public fun times(other: Short) : Double
|
|
||||||
public fun times(other: Byte) : Double
|
|
||||||
public fun times(other: Char) : Double
|
|
||||||
|
|
||||||
public fun div(other: Double): Double
|
|
||||||
public fun div(other: Float) : Double
|
|
||||||
public fun div(other: Long) : Double
|
|
||||||
public fun div(other: Int) : Double
|
|
||||||
public fun div(other: Short) : Double
|
|
||||||
public fun div(other: Byte) : Double
|
|
||||||
public fun div(other: Char) : Double
|
|
||||||
|
|
||||||
public fun mod(other: Double): Double
|
|
||||||
public fun mod(other: Float) : Double
|
|
||||||
public fun mod(other: Long) : Double
|
|
||||||
public fun mod(other: Int) : Double
|
|
||||||
public fun mod(other: Short) : Double
|
|
||||||
public fun mod(other: Byte) : Double
|
|
||||||
|
|
||||||
public fun rangeTo(other: Double): DoubleRange
|
|
||||||
public fun rangeTo(other: Float) : DoubleRange
|
|
||||||
public fun rangeTo(other: Long) : DoubleRange
|
|
||||||
public fun rangeTo(other: Int) : DoubleRange
|
|
||||||
public fun rangeTo(other: Short) : DoubleRange
|
|
||||||
public fun rangeTo(other: Byte) : DoubleRange
|
|
||||||
public fun rangeTo(other: Char) : DoubleRange
|
|
||||||
|
|
||||||
public fun inc(): Double
|
|
||||||
public fun dec(): Double
|
|
||||||
public fun plus(): Double
|
|
||||||
public fun minus(): Double
|
|
||||||
|
|
||||||
public override fun toDouble(): Double
|
|
||||||
public override fun toFloat(): Float
|
|
||||||
public override fun toLong(): Long
|
|
||||||
public override fun toInt(): Int
|
|
||||||
public override fun toChar(): Char
|
|
||||||
public override fun toShort(): Short
|
|
||||||
public override fun toByte(): Byte
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a single-precision 32-bit IEEE 754 floating point number. On the JVM, non-nullable
|
|
||||||
* values of this type are represented as values of the primitive type `float`.
|
|
||||||
*/
|
|
||||||
public class Float private () : Number, Comparable<Float> {
|
|
||||||
class object : FloatingPointConstants<Float> {}
|
|
||||||
|
|
||||||
public fun compareTo(other: Double): Int
|
|
||||||
public override fun compareTo(other: Float): Int
|
|
||||||
public fun compareTo(other: Long) : Int
|
|
||||||
public fun compareTo(other: Int) : Int
|
|
||||||
public fun compareTo(other: Short) : Int
|
|
||||||
public fun compareTo(other: Byte) : Int
|
|
||||||
public fun compareTo(other: Char) : Int
|
|
||||||
|
|
||||||
public fun plus(other: Double): Double
|
|
||||||
public fun plus(other: Float) : Float
|
|
||||||
public fun plus(other: Long) : Float
|
|
||||||
public fun plus(other: Int) : Float
|
|
||||||
public fun plus(other: Short) : Float
|
|
||||||
public fun plus(other: Byte) : Float
|
|
||||||
public fun plus(other: Char) : Float
|
|
||||||
|
|
||||||
public fun minus(other: Double): Double
|
|
||||||
public fun minus(other: Float) : Float
|
|
||||||
public fun minus(other: Long) : Float
|
|
||||||
public fun minus(other: Int) : Float
|
|
||||||
public fun minus(other: Short) : Float
|
|
||||||
public fun minus(other: Byte) : Float
|
|
||||||
public fun minus(other: Char) : Float
|
|
||||||
|
|
||||||
public fun times(other: Double): Double
|
|
||||||
public fun times(other: Float) : Float
|
|
||||||
public fun times(other: Long) : Float
|
|
||||||
public fun times(other: Int) : Float
|
|
||||||
public fun times(other: Short) : Float
|
|
||||||
public fun times(other: Byte) : Float
|
|
||||||
public fun times(other: Char) : Float
|
|
||||||
|
|
||||||
public fun div(other: Double): Double
|
|
||||||
public fun div(other: Float) : Float
|
|
||||||
public fun div(other: Long) : Float
|
|
||||||
public fun div(other: Int) : Float
|
|
||||||
public fun div(other: Short) : Float
|
|
||||||
public fun div(other: Byte) : Float
|
|
||||||
public fun div(other: Char) : Float
|
|
||||||
|
|
||||||
public fun mod(other: Double): Double
|
|
||||||
public fun mod(other: Float) : Float
|
|
||||||
public fun mod(other: Long) : Float
|
|
||||||
public fun mod(other: Int) : Float
|
|
||||||
public fun mod(other: Short) : Float
|
|
||||||
public fun mod(other: Byte) : Float
|
|
||||||
public fun mod(other: Char) : Float
|
|
||||||
|
|
||||||
public fun rangeTo(other: Double): DoubleRange
|
|
||||||
public fun rangeTo(other: Float) : FloatRange
|
|
||||||
public fun rangeTo(other: Long) : FloatRange
|
|
||||||
public fun rangeTo(other: Int) : FloatRange
|
|
||||||
public fun rangeTo(other: Short) : FloatRange
|
|
||||||
public fun rangeTo(other: Byte) : FloatRange
|
|
||||||
public fun rangeTo(other: Char) : FloatRange
|
|
||||||
|
|
||||||
public fun inc(): Float
|
|
||||||
public fun dec(): Float
|
|
||||||
public fun plus(): Float
|
|
||||||
public fun minus(): Float
|
|
||||||
|
|
||||||
public override fun toDouble(): Double
|
|
||||||
public override fun toFloat(): Float
|
|
||||||
public override fun toLong(): Long
|
|
||||||
public override fun toInt(): Int
|
|
||||||
public override fun toChar(): Char
|
|
||||||
public override fun toShort(): Short
|
|
||||||
public override fun toByte(): Byte
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a 64-bit signed integer. On the JVM, non-nullable values of this type are represented
|
|
||||||
* as values of the primitive type `long`.
|
|
||||||
*/
|
|
||||||
public class Long private () : Number, Comparable<Long> {
|
|
||||||
class object {}
|
class object {}
|
||||||
|
|
||||||
|
public override fun compareTo(other: Byte): Int
|
||||||
|
public fun compareTo(other: Char): Int
|
||||||
|
public fun compareTo(other: Short): Int
|
||||||
|
public fun compareTo(other: Int): Int
|
||||||
|
public fun compareTo(other: Long): Int
|
||||||
|
public fun compareTo(other: Float): Int
|
||||||
public fun compareTo(other: Double): Int
|
public fun compareTo(other: Double): Int
|
||||||
public fun compareTo(other: Float) : Int
|
|
||||||
public override fun compareTo(other: Long): Int
|
|
||||||
public fun compareTo(other: Int) : Int
|
|
||||||
public fun compareTo(other: Short) : Int
|
|
||||||
public fun compareTo(other: Byte) : Int
|
|
||||||
public fun compareTo(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun plus(other: Byte): Int
|
||||||
|
public fun plus(other: Char): Int
|
||||||
|
public fun plus(other: Short): Int
|
||||||
|
public fun plus(other: Int): Int
|
||||||
|
public fun plus(other: Long): Long
|
||||||
|
public fun plus(other: Float): Float
|
||||||
public fun plus(other: Double): Double
|
public fun plus(other: Double): Double
|
||||||
public fun plus(other: Float) : Float
|
|
||||||
public fun plus(other: Long) : Long
|
|
||||||
public fun plus(other: Int) : Long
|
|
||||||
public fun plus(other: Short) : Long
|
|
||||||
public fun plus(other: Byte) : Long
|
|
||||||
public fun plus(other: Char) : Long
|
|
||||||
|
|
||||||
|
public fun minus(other: Byte): Int
|
||||||
|
public fun minus(other: Char): Int
|
||||||
|
public fun minus(other: Short): Int
|
||||||
|
public fun minus(other: Int): Int
|
||||||
|
public fun minus(other: Long): Long
|
||||||
|
public fun minus(other: Float): Float
|
||||||
public fun minus(other: Double): Double
|
public fun minus(other: Double): Double
|
||||||
public fun minus(other: Float) : Float
|
|
||||||
public fun minus(other: Long) : Long
|
|
||||||
public fun minus(other: Int) : Long
|
|
||||||
public fun minus(other: Short) : Long
|
|
||||||
public fun minus(other: Byte) : Long
|
|
||||||
public fun minus(other: Char) : Long
|
|
||||||
|
|
||||||
|
public fun times(other: Byte): Int
|
||||||
|
public fun times(other: Char): Int
|
||||||
|
public fun times(other: Short): Int
|
||||||
|
public fun times(other: Int): Int
|
||||||
|
public fun times(other: Long): Long
|
||||||
|
public fun times(other: Float): Float
|
||||||
public fun times(other: Double): Double
|
public fun times(other: Double): Double
|
||||||
public fun times(other: Float) : Float
|
|
||||||
public fun times(other: Long) : Long
|
|
||||||
public fun times(other: Int) : Long
|
|
||||||
public fun times(other: Short) : Long
|
|
||||||
public fun times(other: Byte) : Long
|
|
||||||
public fun times(other: Char) : Long
|
|
||||||
|
|
||||||
|
public fun div(other: Byte): Int
|
||||||
|
public fun div(other: Char): Int
|
||||||
|
public fun div(other: Short): Int
|
||||||
|
public fun div(other: Int): Int
|
||||||
|
public fun div(other: Long): Long
|
||||||
|
public fun div(other: Float): Float
|
||||||
public fun div(other: Double): Double
|
public fun div(other: Double): Double
|
||||||
public fun div(other: Float) : Float
|
|
||||||
public fun div(other: Long) : Long
|
|
||||||
public fun div(other: Int) : Long
|
|
||||||
public fun div(other: Short) : Long
|
|
||||||
public fun div(other: Byte) : Long
|
|
||||||
public fun div(other: Char) : Long
|
|
||||||
|
|
||||||
|
public fun mod(other: Byte): Int
|
||||||
|
public fun mod(other: Char): Int
|
||||||
|
public fun mod(other: Short): Int
|
||||||
|
public fun mod(other: Int): Int
|
||||||
|
public fun mod(other: Long): Long
|
||||||
|
public fun mod(other: Float): Float
|
||||||
public fun mod(other: Double): Double
|
public fun mod(other: Double): Double
|
||||||
public fun mod(other: Float) : Float
|
|
||||||
public fun mod(other: Long) : Long
|
|
||||||
public fun mod(other: Int) : Long
|
|
||||||
public fun mod(other: Short) : Long
|
|
||||||
public fun mod(other: Byte) : Long
|
|
||||||
public fun mod(other: Char) : Long
|
|
||||||
|
|
||||||
|
public fun inc(): Byte
|
||||||
|
public fun dec(): Byte
|
||||||
|
public fun plus(): Int
|
||||||
|
public fun minus(): Int
|
||||||
|
|
||||||
|
public fun rangeTo(other: Byte): ByteRange
|
||||||
|
public fun rangeTo(other: Char): CharRange
|
||||||
|
public fun rangeTo(other: Short): ShortRange
|
||||||
|
public fun rangeTo(other: Int): IntRange
|
||||||
|
public fun rangeTo(other: Long): LongRange
|
||||||
|
public fun rangeTo(other: Float): FloatRange
|
||||||
public fun rangeTo(other: Double): DoubleRange
|
public fun rangeTo(other: Double): DoubleRange
|
||||||
public fun rangeTo(other: Float) : FloatRange
|
|
||||||
public fun rangeTo(other: Long) : LongRange
|
|
||||||
public fun rangeTo(other: Int) : LongRange
|
|
||||||
public fun rangeTo(other: Short) : LongRange
|
|
||||||
public fun rangeTo(other: Byte) : LongRange
|
|
||||||
public fun rangeTo(other: Char) : LongRange
|
|
||||||
|
|
||||||
public fun inc(): Long
|
public override fun toByte(): Byte
|
||||||
public fun dec(): Long
|
|
||||||
public fun plus(): Long
|
|
||||||
public fun minus(): Long
|
|
||||||
|
|
||||||
public fun shl(bits: Int): Long
|
|
||||||
public fun shr(bits: Int): Long
|
|
||||||
public fun ushr(bits: Int): Long
|
|
||||||
public fun and(other: Long): Long
|
|
||||||
public fun or(other: Long): Long
|
|
||||||
public fun xor(other: Long): Long
|
|
||||||
public fun inv(): Long
|
|
||||||
|
|
||||||
public override fun toDouble(): Double
|
|
||||||
public override fun toFloat(): Float
|
|
||||||
public override fun toLong(): Long
|
|
||||||
public override fun toInt(): Int
|
|
||||||
public override fun toChar(): Char
|
public override fun toChar(): Char
|
||||||
public override fun toShort(): Short
|
public override fun toShort(): Short
|
||||||
public override fun toByte(): Byte
|
public override fun toInt(): Int
|
||||||
|
public override fun toLong(): Long
|
||||||
|
public override fun toFloat(): Float
|
||||||
|
public override fun toDouble(): Double
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a 32-bit signed integer. On the JVM, non-nullable values of this type are represented
|
* Represents a 16-bit signed integer.
|
||||||
* as values of the primitive type `int`.
|
* On the JVM, non-nullable values of this type are represented as values of the primitive type `short`.
|
||||||
|
*/
|
||||||
|
public class Short private () : Number, Comparable<Short> {
|
||||||
|
class object {}
|
||||||
|
|
||||||
|
public fun compareTo(other: Byte): Int
|
||||||
|
public fun compareTo(other: Char): Int
|
||||||
|
public override fun compareTo(other: Short): Int
|
||||||
|
public fun compareTo(other: Int): Int
|
||||||
|
public fun compareTo(other: Long): Int
|
||||||
|
public fun compareTo(other: Float): Int
|
||||||
|
public fun compareTo(other: Double): Int
|
||||||
|
|
||||||
|
public fun plus(other: Byte): Int
|
||||||
|
public fun plus(other: Char): Int
|
||||||
|
public fun plus(other: Short): Int
|
||||||
|
public fun plus(other: Int): Int
|
||||||
|
public fun plus(other: Long): Long
|
||||||
|
public fun plus(other: Float): Float
|
||||||
|
public fun plus(other: Double): Double
|
||||||
|
|
||||||
|
public fun minus(other: Byte): Int
|
||||||
|
public fun minus(other: Char): Int
|
||||||
|
public fun minus(other: Short): Int
|
||||||
|
public fun minus(other: Int): Int
|
||||||
|
public fun minus(other: Long): Long
|
||||||
|
public fun minus(other: Float): Float
|
||||||
|
public fun minus(other: Double): Double
|
||||||
|
|
||||||
|
public fun times(other: Byte): Int
|
||||||
|
public fun times(other: Char): Int
|
||||||
|
public fun times(other: Short): Int
|
||||||
|
public fun times(other: Int): Int
|
||||||
|
public fun times(other: Long): Long
|
||||||
|
public fun times(other: Float): Float
|
||||||
|
public fun times(other: Double): Double
|
||||||
|
|
||||||
|
public fun div(other: Byte): Int
|
||||||
|
public fun div(other: Char): Int
|
||||||
|
public fun div(other: Short): Int
|
||||||
|
public fun div(other: Int): Int
|
||||||
|
public fun div(other: Long): Long
|
||||||
|
public fun div(other: Float): Float
|
||||||
|
public fun div(other: Double): Double
|
||||||
|
|
||||||
|
public fun mod(other: Byte): Int
|
||||||
|
public fun mod(other: Char): Int
|
||||||
|
public fun mod(other: Short): Int
|
||||||
|
public fun mod(other: Int): Int
|
||||||
|
public fun mod(other: Long): Long
|
||||||
|
public fun mod(other: Float): Float
|
||||||
|
public fun mod(other: Double): Double
|
||||||
|
|
||||||
|
public fun inc(): Short
|
||||||
|
public fun dec(): Short
|
||||||
|
public fun plus(): Int
|
||||||
|
public fun minus(): Int
|
||||||
|
|
||||||
|
public fun rangeTo(other: Byte): ShortRange
|
||||||
|
public fun rangeTo(other: Char): ShortRange
|
||||||
|
public fun rangeTo(other: Short): ShortRange
|
||||||
|
public fun rangeTo(other: Int): IntRange
|
||||||
|
public fun rangeTo(other: Long): LongRange
|
||||||
|
public fun rangeTo(other: Float): FloatRange
|
||||||
|
public fun rangeTo(other: Double): DoubleRange
|
||||||
|
|
||||||
|
public override fun toByte(): Byte
|
||||||
|
public override fun toChar(): Char
|
||||||
|
public override fun toShort(): Short
|
||||||
|
public override fun toInt(): Int
|
||||||
|
public override fun toLong(): Long
|
||||||
|
public override fun toFloat(): Float
|
||||||
|
public override fun toDouble(): Double
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a 32-bit signed integer.
|
||||||
|
* On the JVM, non-nullable values of this type are represented as values of the primitive type `int`.
|
||||||
*/
|
*/
|
||||||
public class Int private () : Number, Comparable<Int> {
|
public class Int private () : Number, Comparable<Int> {
|
||||||
class object {}
|
class object {}
|
||||||
|
|
||||||
public fun compareTo(other: Double): Int
|
public fun compareTo(other: Byte): Int
|
||||||
public fun compareTo(other: Float) : Int
|
public fun compareTo(other: Char): Int
|
||||||
public fun compareTo(other: Long) : Int
|
public fun compareTo(other: Short): Int
|
||||||
public override fun compareTo(other: Int): Int
|
public override fun compareTo(other: Int): Int
|
||||||
public fun compareTo(other: Short) : Int
|
public fun compareTo(other: Long): Int
|
||||||
public fun compareTo(other: Byte) : Int
|
public fun compareTo(other: Float): Int
|
||||||
public fun compareTo(other: Char) : Int
|
public fun compareTo(other: Double): Int
|
||||||
|
|
||||||
|
public fun plus(other: Byte): Int
|
||||||
|
public fun plus(other: Char): Int
|
||||||
|
public fun plus(other: Short): Int
|
||||||
|
public fun plus(other: Int): Int
|
||||||
|
public fun plus(other: Long): Long
|
||||||
|
public fun plus(other: Float): Float
|
||||||
public fun plus(other: Double): Double
|
public fun plus(other: Double): Double
|
||||||
public fun plus(other: Float) : Float
|
|
||||||
public fun plus(other: Long) : Long
|
|
||||||
public fun plus(other: Int) : Int
|
|
||||||
public fun plus(other: Short) : Int
|
|
||||||
public fun plus(other: Byte) : Int
|
|
||||||
public fun plus(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun minus(other: Byte): Int
|
||||||
|
public fun minus(other: Char): Int
|
||||||
|
public fun minus(other: Short): Int
|
||||||
|
public fun minus(other: Int): Int
|
||||||
|
public fun minus(other: Long): Long
|
||||||
|
public fun minus(other: Float): Float
|
||||||
public fun minus(other: Double): Double
|
public fun minus(other: Double): Double
|
||||||
public fun minus(other: Float) : Float
|
|
||||||
public fun minus(other: Long) : Long
|
|
||||||
public fun minus(other: Int) : Int
|
|
||||||
public fun minus(other: Short) : Int
|
|
||||||
public fun minus(other: Byte) : Int
|
|
||||||
public fun minus(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun times(other: Byte): Int
|
||||||
|
public fun times(other: Char): Int
|
||||||
|
public fun times(other: Short): Int
|
||||||
|
public fun times(other: Int): Int
|
||||||
|
public fun times(other: Long): Long
|
||||||
|
public fun times(other: Float): Float
|
||||||
public fun times(other: Double): Double
|
public fun times(other: Double): Double
|
||||||
public fun times(other: Float) : Float
|
|
||||||
public fun times(other: Long) : Long
|
|
||||||
public fun times(other: Int) : Int
|
|
||||||
public fun times(other: Short) : Int
|
|
||||||
public fun times(other: Byte) : Int
|
|
||||||
public fun times(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun div(other: Byte): Int
|
||||||
|
public fun div(other: Char): Int
|
||||||
|
public fun div(other: Short): Int
|
||||||
|
public fun div(other: Int): Int
|
||||||
|
public fun div(other: Long): Long
|
||||||
|
public fun div(other: Float): Float
|
||||||
public fun div(other: Double): Double
|
public fun div(other: Double): Double
|
||||||
public fun div(other: Float) : Float
|
|
||||||
public fun div(other: Long) : Long
|
|
||||||
public fun div(other: Int) : Int
|
|
||||||
public fun div(other: Short) : Int
|
|
||||||
public fun div(other: Byte) : Int
|
|
||||||
public fun div(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun mod(other: Byte): Int
|
||||||
|
public fun mod(other: Char): Int
|
||||||
|
public fun mod(other: Short): Int
|
||||||
|
public fun mod(other: Int): Int
|
||||||
|
public fun mod(other: Long): Long
|
||||||
|
public fun mod(other: Float): Float
|
||||||
public fun mod(other: Double): Double
|
public fun mod(other: Double): Double
|
||||||
public fun mod(other: Float) : Float
|
|
||||||
public fun mod(other: Long) : Long
|
|
||||||
public fun mod(other: Int) : Int
|
|
||||||
public fun mod(other: Short) : Int
|
|
||||||
public fun mod(other: Byte) : Int
|
|
||||||
public fun mod(other: Char) : Int
|
|
||||||
|
|
||||||
public fun rangeTo(other: Double): DoubleRange
|
|
||||||
public fun rangeTo(other: Float) : FloatRange
|
|
||||||
public fun rangeTo(other: Long) : LongRange
|
|
||||||
public fun rangeTo(other: Int) : IntRange
|
|
||||||
public fun rangeTo(other: Short) : IntRange
|
|
||||||
public fun rangeTo(other: Byte) : IntRange
|
|
||||||
public fun rangeTo(other: Char) : IntRange
|
|
||||||
|
|
||||||
public fun inc(): Int
|
public fun inc(): Int
|
||||||
public fun dec(): Int
|
public fun dec(): Int
|
||||||
public fun plus(): Int
|
public fun plus(): Int
|
||||||
public fun minus(): Int
|
public fun minus(): Int
|
||||||
|
|
||||||
|
public fun rangeTo(other: Byte): IntRange
|
||||||
|
public fun rangeTo(other: Char): IntRange
|
||||||
|
public fun rangeTo(other: Short): IntRange
|
||||||
|
public fun rangeTo(other: Int): IntRange
|
||||||
|
public fun rangeTo(other: Long): LongRange
|
||||||
|
public fun rangeTo(other: Float): FloatRange
|
||||||
|
public fun rangeTo(other: Double): DoubleRange
|
||||||
|
|
||||||
public fun shl(bits: Int): Int
|
public fun shl(bits: Int): Int
|
||||||
public fun shr(bits: Int): Int
|
public fun shr(bits: Int): Int
|
||||||
public fun ushr(bits: Int): Int
|
public fun ushr(bits: Int): Int
|
||||||
@@ -370,165 +248,251 @@ public class Int private () : Number, Comparable<Int> {
|
|||||||
public fun xor(other: Int): Int
|
public fun xor(other: Int): Int
|
||||||
public fun inv(): Int
|
public fun inv(): Int
|
||||||
|
|
||||||
public override fun toDouble(): Double
|
public override fun toByte(): Byte
|
||||||
public override fun toFloat(): Float
|
|
||||||
public override fun toLong(): Long
|
|
||||||
public override fun toInt(): Int
|
|
||||||
public override fun toChar(): Char
|
public override fun toChar(): Char
|
||||||
public override fun toShort(): Short
|
public override fun toShort(): Short
|
||||||
public override fun toByte(): Byte
|
public override fun toInt(): Int
|
||||||
|
public override fun toLong(): Long
|
||||||
|
public override fun toFloat(): Float
|
||||||
|
public override fun toDouble(): Double
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a 16-bit signed integer. On the JVM, non-nullable values of this type are represented
|
* Represents a 64-bit signed integer.
|
||||||
* as values of the primitive type `short`.
|
* On the JVM, non-nullable values of this type are represented as values of the primitive type `long`.
|
||||||
*/
|
*/
|
||||||
public class Short private () : Number, Comparable<Short> {
|
public class Long private () : Number, Comparable<Long> {
|
||||||
class object {}
|
class object {}
|
||||||
|
|
||||||
|
public fun compareTo(other: Byte): Int
|
||||||
|
public fun compareTo(other: Char): Int
|
||||||
|
public fun compareTo(other: Short): Int
|
||||||
|
public fun compareTo(other: Int): Int
|
||||||
|
public override fun compareTo(other: Long): Int
|
||||||
|
public fun compareTo(other: Float): Int
|
||||||
public fun compareTo(other: Double): Int
|
public fun compareTo(other: Double): Int
|
||||||
public fun compareTo(other: Float) : Int
|
|
||||||
public fun compareTo(other: Long) : Int
|
|
||||||
public fun compareTo(other: Int) : Int
|
|
||||||
public override fun compareTo(other: Short): Int
|
|
||||||
public fun compareTo(other: Byte) : Int
|
|
||||||
public fun compareTo(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun plus(other: Byte): Long
|
||||||
|
public fun plus(other: Char): Long
|
||||||
|
public fun plus(other: Short): Long
|
||||||
|
public fun plus(other: Int): Long
|
||||||
|
public fun plus(other: Long): Long
|
||||||
|
public fun plus(other: Float): Float
|
||||||
public fun plus(other: Double): Double
|
public fun plus(other: Double): Double
|
||||||
public fun plus(other: Float) : Float
|
|
||||||
public fun plus(other: Long) : Long
|
|
||||||
public fun plus(other: Int) : Int
|
|
||||||
public fun plus(other: Short) : Int
|
|
||||||
public fun plus(other: Byte) : Int
|
|
||||||
public fun plus(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun minus(other: Byte): Long
|
||||||
|
public fun minus(other: Char): Long
|
||||||
|
public fun minus(other: Short): Long
|
||||||
|
public fun minus(other: Int): Long
|
||||||
|
public fun minus(other: Long): Long
|
||||||
|
public fun minus(other: Float): Float
|
||||||
public fun minus(other: Double): Double
|
public fun minus(other: Double): Double
|
||||||
public fun minus(other: Float) : Float
|
|
||||||
public fun minus(other: Long) : Long
|
|
||||||
public fun minus(other: Int) : Int
|
|
||||||
public fun minus(other: Short) : Int
|
|
||||||
public fun minus(other: Byte) : Int
|
|
||||||
public fun minus(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun times(other: Byte): Long
|
||||||
|
public fun times(other: Char): Long
|
||||||
|
public fun times(other: Short): Long
|
||||||
|
public fun times(other: Int): Long
|
||||||
|
public fun times(other: Long): Long
|
||||||
|
public fun times(other: Float): Float
|
||||||
public fun times(other: Double): Double
|
public fun times(other: Double): Double
|
||||||
public fun times(other: Float) : Float
|
|
||||||
public fun times(other: Long) : Long
|
|
||||||
public fun times(other: Int) : Int
|
|
||||||
public fun times(other: Short) : Int
|
|
||||||
public fun times(other: Byte) : Int
|
|
||||||
public fun times(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun div(other: Byte): Long
|
||||||
|
public fun div(other: Char): Long
|
||||||
|
public fun div(other: Short): Long
|
||||||
|
public fun div(other: Int): Long
|
||||||
|
public fun div(other: Long): Long
|
||||||
|
public fun div(other: Float): Float
|
||||||
public fun div(other: Double): Double
|
public fun div(other: Double): Double
|
||||||
public fun div(other: Float) : Float
|
|
||||||
public fun div(other: Long) : Long
|
|
||||||
public fun div(other: Int) : Int
|
|
||||||
public fun div(other: Short) : Int
|
|
||||||
public fun div(other: Byte) : Int
|
|
||||||
public fun div(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun mod(other: Byte): Long
|
||||||
|
public fun mod(other: Char): Long
|
||||||
|
public fun mod(other: Short): Long
|
||||||
|
public fun mod(other: Int): Long
|
||||||
|
public fun mod(other: Long): Long
|
||||||
|
public fun mod(other: Float): Float
|
||||||
public fun mod(other: Double): Double
|
public fun mod(other: Double): Double
|
||||||
public fun mod(other: Float) : Float
|
|
||||||
public fun mod(other: Long) : Long
|
|
||||||
public fun mod(other: Int) : Int
|
|
||||||
public fun mod(other: Short) : Int
|
|
||||||
public fun mod(other: Byte) : Int
|
|
||||||
public fun mod(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun inc(): Long
|
||||||
|
public fun dec(): Long
|
||||||
|
public fun plus(): Long
|
||||||
|
public fun minus(): Long
|
||||||
|
|
||||||
|
public fun rangeTo(other: Byte): LongRange
|
||||||
|
public fun rangeTo(other: Char): LongRange
|
||||||
|
public fun rangeTo(other: Short): LongRange
|
||||||
|
public fun rangeTo(other: Int): LongRange
|
||||||
|
public fun rangeTo(other: Long): LongRange
|
||||||
|
public fun rangeTo(other: Float): FloatRange
|
||||||
public fun rangeTo(other: Double): DoubleRange
|
public fun rangeTo(other: Double): DoubleRange
|
||||||
public fun rangeTo(other: Float) : FloatRange
|
|
||||||
public fun rangeTo(other: Long) : LongRange
|
|
||||||
public fun rangeTo(other: Int) : IntRange
|
|
||||||
public fun rangeTo(other: Short) : ShortRange
|
|
||||||
public fun rangeTo(other: Byte) : ShortRange
|
|
||||||
public fun rangeTo(other: Char) : ShortRange
|
|
||||||
|
|
||||||
public fun inc(): Short
|
public fun shl(bits: Int): Long
|
||||||
public fun dec(): Short
|
public fun shr(bits: Int): Long
|
||||||
public fun plus(): Int
|
public fun ushr(bits: Int): Long
|
||||||
public fun minus(): Int
|
public fun and(other: Long): Long
|
||||||
|
public fun or(other: Long): Long
|
||||||
|
public fun xor(other: Long): Long
|
||||||
|
public fun inv(): Long
|
||||||
|
|
||||||
public override fun toDouble(): Double
|
public override fun toByte(): Byte
|
||||||
public override fun toFloat(): Float
|
|
||||||
public override fun toLong(): Long
|
|
||||||
public override fun toInt(): Int
|
|
||||||
public override fun toChar(): Char
|
public override fun toChar(): Char
|
||||||
public override fun toShort(): Short
|
public override fun toShort(): Short
|
||||||
public override fun toByte(): Byte
|
public override fun toInt(): Int
|
||||||
|
public override fun toLong(): Long
|
||||||
|
public override fun toFloat(): Float
|
||||||
|
public override fun toDouble(): Double
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a 8-bit signed integer. On the JVM, non-nullable values of this type are represented
|
* Represents a single-precision 32-bit IEEE 754 floating point number.
|
||||||
* as values of the primitive type `byte`.
|
* On the JVM, non-nullable values of this type are represented as values of the primitive type `float`.
|
||||||
*/
|
*/
|
||||||
public class Byte private () : Number, Comparable<Byte> {
|
public class Float private () : Number, Comparable<Float> {
|
||||||
class object {}
|
class object : FloatingPointConstants<Float> {}
|
||||||
|
|
||||||
|
public fun compareTo(other: Byte): Int
|
||||||
|
public fun compareTo(other: Char): Int
|
||||||
|
public fun compareTo(other: Short): Int
|
||||||
|
public fun compareTo(other: Int): Int
|
||||||
|
public fun compareTo(other: Long): Int
|
||||||
|
public override fun compareTo(other: Float): Int
|
||||||
public fun compareTo(other: Double): Int
|
public fun compareTo(other: Double): Int
|
||||||
public fun compareTo(other: Float) : Int
|
|
||||||
public fun compareTo(other: Long) : Int
|
|
||||||
public fun compareTo(other: Int) : Int
|
|
||||||
public fun compareTo(other: Short) : Int
|
|
||||||
public fun compareTo(other: Char) : Int
|
|
||||||
public override fun compareTo(other: Byte): Int
|
|
||||||
|
|
||||||
|
public fun plus(other: Byte): Float
|
||||||
|
public fun plus(other: Char): Float
|
||||||
|
public fun plus(other: Short): Float
|
||||||
|
public fun plus(other: Int): Float
|
||||||
|
public fun plus(other: Long): Float
|
||||||
|
public fun plus(other: Float): Float
|
||||||
public fun plus(other: Double): Double
|
public fun plus(other: Double): Double
|
||||||
public fun plus(other: Float) : Float
|
|
||||||
public fun plus(other: Long) : Long
|
|
||||||
public fun plus(other: Int) : Int
|
|
||||||
public fun plus(other: Short) : Int
|
|
||||||
public fun plus(other: Byte) : Int
|
|
||||||
public fun plus(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun minus(other: Byte): Float
|
||||||
|
public fun minus(other: Char): Float
|
||||||
|
public fun minus(other: Short): Float
|
||||||
|
public fun minus(other: Int): Float
|
||||||
|
public fun minus(other: Long): Float
|
||||||
|
public fun minus(other: Float): Float
|
||||||
public fun minus(other: Double): Double
|
public fun minus(other: Double): Double
|
||||||
public fun minus(other: Float) : Float
|
|
||||||
public fun minus(other: Long) : Long
|
|
||||||
public fun minus(other: Int) : Int
|
|
||||||
public fun minus(other: Short) : Int
|
|
||||||
public fun minus(other: Byte) : Int
|
|
||||||
public fun minus(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun times(other: Byte): Float
|
||||||
|
public fun times(other: Char): Float
|
||||||
|
public fun times(other: Short): Float
|
||||||
|
public fun times(other: Int): Float
|
||||||
|
public fun times(other: Long): Float
|
||||||
|
public fun times(other: Float): Float
|
||||||
public fun times(other: Double): Double
|
public fun times(other: Double): Double
|
||||||
public fun times(other: Float) : Float
|
|
||||||
public fun times(other: Long) : Long
|
|
||||||
public fun times(other: Int) : Int
|
|
||||||
public fun times(other: Short) : Int
|
|
||||||
public fun times(other: Byte) : Int
|
|
||||||
public fun times(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun div(other: Byte): Float
|
||||||
|
public fun div(other: Char): Float
|
||||||
|
public fun div(other: Short): Float
|
||||||
|
public fun div(other: Int): Float
|
||||||
|
public fun div(other: Long): Float
|
||||||
|
public fun div(other: Float): Float
|
||||||
public fun div(other: Double): Double
|
public fun div(other: Double): Double
|
||||||
public fun div(other: Float) : Float
|
|
||||||
public fun div(other: Long) : Long
|
|
||||||
public fun div(other: Int) : Int
|
|
||||||
public fun div(other: Short) : Int
|
|
||||||
public fun div(other: Byte) : Int
|
|
||||||
public fun div(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun mod(other: Byte): Float
|
||||||
|
public fun mod(other: Char): Float
|
||||||
|
public fun mod(other: Short): Float
|
||||||
|
public fun mod(other: Int): Float
|
||||||
|
public fun mod(other: Long): Float
|
||||||
|
public fun mod(other: Float): Float
|
||||||
public fun mod(other: Double): Double
|
public fun mod(other: Double): Double
|
||||||
public fun mod(other: Float) : Float
|
|
||||||
public fun mod(other: Long) : Long
|
|
||||||
public fun mod(other: Int) : Int
|
|
||||||
public fun mod(other: Short) : Int
|
|
||||||
public fun mod(other: Byte) : Int
|
|
||||||
public fun mod(other: Char) : Int
|
|
||||||
|
|
||||||
|
public fun inc(): Float
|
||||||
|
public fun dec(): Float
|
||||||
|
public fun plus(): Float
|
||||||
|
public fun minus(): Float
|
||||||
|
|
||||||
|
public fun rangeTo(other: Byte): FloatRange
|
||||||
|
public fun rangeTo(other: Char): FloatRange
|
||||||
|
public fun rangeTo(other: Short): FloatRange
|
||||||
|
public fun rangeTo(other: Int): FloatRange
|
||||||
|
public fun rangeTo(other: Long): FloatRange
|
||||||
|
public fun rangeTo(other: Float): FloatRange
|
||||||
public fun rangeTo(other: Double): DoubleRange
|
public fun rangeTo(other: Double): DoubleRange
|
||||||
public fun rangeTo(other: Float) : FloatRange
|
|
||||||
public fun rangeTo(other: Long) : LongRange
|
|
||||||
public fun rangeTo(other: Int) : IntRange
|
|
||||||
public fun rangeTo(other: Short) : ShortRange
|
|
||||||
public fun rangeTo(other: Byte) : ByteRange
|
|
||||||
public fun rangeTo(other: Char) : CharRange
|
|
||||||
|
|
||||||
public fun inc(): Byte
|
public override fun toByte(): Byte
|
||||||
public fun dec(): Byte
|
|
||||||
public fun plus(): Int
|
|
||||||
public fun minus(): Int
|
|
||||||
|
|
||||||
public override fun toDouble(): Double
|
|
||||||
public override fun toFloat(): Float
|
|
||||||
public override fun toLong(): Long
|
|
||||||
public override fun toInt(): Int
|
|
||||||
public override fun toChar(): Char
|
public override fun toChar(): Char
|
||||||
public override fun toShort(): Short
|
public override fun toShort(): Short
|
||||||
public override fun toByte(): Byte
|
public override fun toInt(): Int
|
||||||
|
public override fun toLong(): Long
|
||||||
|
public override fun toFloat(): Float
|
||||||
|
public override fun toDouble(): Double
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a double-precision 64-bit IEEE 754 floating point number.
|
||||||
|
* On the JVM, non-nullable values of this type are represented as values of the primitive type `double`.
|
||||||
|
*/
|
||||||
|
public class Double private () : Number, Comparable<Double> {
|
||||||
|
class object : FloatingPointConstants<Double> {}
|
||||||
|
|
||||||
|
public fun compareTo(other: Byte): Int
|
||||||
|
public fun compareTo(other: Char): Int
|
||||||
|
public fun compareTo(other: Short): Int
|
||||||
|
public fun compareTo(other: Int): Int
|
||||||
|
public fun compareTo(other: Long): Int
|
||||||
|
public fun compareTo(other: Float): Int
|
||||||
|
public override fun compareTo(other: Double): Int
|
||||||
|
|
||||||
|
public fun plus(other: Byte): Double
|
||||||
|
public fun plus(other: Char): Double
|
||||||
|
public fun plus(other: Short): Double
|
||||||
|
public fun plus(other: Int): Double
|
||||||
|
public fun plus(other: Long): Double
|
||||||
|
public fun plus(other: Float): Double
|
||||||
|
public fun plus(other: Double): Double
|
||||||
|
|
||||||
|
public fun minus(other: Byte): Double
|
||||||
|
public fun minus(other: Char): Double
|
||||||
|
public fun minus(other: Short): Double
|
||||||
|
public fun minus(other: Int): Double
|
||||||
|
public fun minus(other: Long): Double
|
||||||
|
public fun minus(other: Float): Double
|
||||||
|
public fun minus(other: Double): Double
|
||||||
|
|
||||||
|
public fun times(other: Byte): Double
|
||||||
|
public fun times(other: Char): Double
|
||||||
|
public fun times(other: Short): Double
|
||||||
|
public fun times(other: Int): Double
|
||||||
|
public fun times(other: Long): Double
|
||||||
|
public fun times(other: Float): Double
|
||||||
|
public fun times(other: Double): Double
|
||||||
|
|
||||||
|
public fun div(other: Byte): Double
|
||||||
|
public fun div(other: Char): Double
|
||||||
|
public fun div(other: Short): Double
|
||||||
|
public fun div(other: Int): Double
|
||||||
|
public fun div(other: Long): Double
|
||||||
|
public fun div(other: Float): Double
|
||||||
|
public fun div(other: Double): Double
|
||||||
|
|
||||||
|
public fun mod(other: Byte): Double
|
||||||
|
public fun mod(other: Char): Double
|
||||||
|
public fun mod(other: Short): Double
|
||||||
|
public fun mod(other: Int): Double
|
||||||
|
public fun mod(other: Long): Double
|
||||||
|
public fun mod(other: Float): Double
|
||||||
|
public fun mod(other: Double): Double
|
||||||
|
|
||||||
|
public fun inc(): Double
|
||||||
|
public fun dec(): Double
|
||||||
|
public fun plus(): Double
|
||||||
|
public fun minus(): Double
|
||||||
|
|
||||||
|
public fun rangeTo(other: Byte): DoubleRange
|
||||||
|
public fun rangeTo(other: Char): DoubleRange
|
||||||
|
public fun rangeTo(other: Short): DoubleRange
|
||||||
|
public fun rangeTo(other: Int): DoubleRange
|
||||||
|
public fun rangeTo(other: Long): DoubleRange
|
||||||
|
public fun rangeTo(other: Float): DoubleRange
|
||||||
|
public fun rangeTo(other: Double): DoubleRange
|
||||||
|
|
||||||
|
public override fun toByte(): Byte
|
||||||
|
public override fun toChar(): Char
|
||||||
|
public override fun toShort(): Short
|
||||||
|
public override fun toInt(): Int
|
||||||
|
public override fun toLong(): Long
|
||||||
|
public override fun toFloat(): Float
|
||||||
|
public override fun toDouble(): Double
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.generators.builtins
|
package org.jetbrains.kotlin.generators.builtins
|
||||||
|
|
||||||
import org.jetbrains.kotlin.generators.builtins.ProgressionKind.*
|
import org.jetbrains.kotlin.generators.builtins.ProgressionKind.*
|
||||||
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
enum class PrimitiveType {
|
enum class PrimitiveType {
|
||||||
BYTE
|
BYTE
|
||||||
@@ -29,6 +30,9 @@ enum class PrimitiveType {
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
|
|
||||||
val capitalized: String get() = name().toLowerCase().capitalize()
|
val capitalized: String get() = name().toLowerCase().capitalize()
|
||||||
|
class object {
|
||||||
|
val exceptBoolean: Iterable<PrimitiveType> by Delegates.lazy { PrimitiveType.values().filterNot { it == BOOLEAN } }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class ProgressionKind {
|
enum class ProgressionKind {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsSourceGenerator)
|
|||||||
}
|
}
|
||||||
|
|
||||||
generate(File(BUILT_INS_NATIVE_DIR, "Arrays.kt")) { GenerateArrays(it) }
|
generate(File(BUILT_INS_NATIVE_DIR, "Arrays.kt")) { GenerateArrays(it) }
|
||||||
|
generate(File(BUILT_INS_NATIVE_DIR, "Numbers.kt")) { GenerateNumbers(it) }
|
||||||
generate(File(BUILT_INS_SRC_DIR, "Iterators.kt")) { GenerateIterators(it) }
|
generate(File(BUILT_INS_SRC_DIR, "Iterators.kt")) { GenerateIterators(it) }
|
||||||
generate(File(RUNTIME_JVM_DIR, "jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) }
|
generate(File(RUNTIME_JVM_DIR, "jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) }
|
||||||
generate(File(BUILT_INS_SRC_DIR, "ProgressionIterators.kt")) { GenerateProgressionIterators(it) }
|
generate(File(BUILT_INS_SRC_DIR, "ProgressionIterators.kt")) { GenerateProgressionIterators(it) }
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2015 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.kotlin.generators.builtins.ranges
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.generators.builtins.PrimitiveType
|
||||||
|
import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsSourceGenerator
|
||||||
|
import java.io.PrintWriter
|
||||||
|
|
||||||
|
class GenerateNumbers(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||||
|
private val binaryOperators: List<String> = listOf("plus", "minus", "times", "div", "mod")
|
||||||
|
private val unaryOperators: List<String> = listOf("inc", "dec", "plus", "minus")
|
||||||
|
private val shiftOperators: List<String> = listOf("shl", "shr", "ushr")
|
||||||
|
private val bitwiseOperators: List<String> = listOf("and", "or", "xor")
|
||||||
|
private val typeDescriptions: Map<PrimitiveType, String> = hashMapOf(
|
||||||
|
PrimitiveType.DOUBLE to "double-precision 64-bit IEEE 754 floating point number",
|
||||||
|
PrimitiveType.FLOAT to "single-precision 32-bit IEEE 754 floating point number",
|
||||||
|
PrimitiveType.LONG to "64-bit signed integer",
|
||||||
|
PrimitiveType.INT to "32-bit signed integer",
|
||||||
|
PrimitiveType.SHORT to "16-bit signed integer",
|
||||||
|
PrimitiveType.BYTE to "8-bit signed integer"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
override fun generateBody() {
|
||||||
|
for (kind in PrimitiveType.values()) {
|
||||||
|
if (kind == PrimitiveType.BOOLEAN || kind == PrimitiveType.CHAR) continue
|
||||||
|
val className = kind.capitalized
|
||||||
|
generateDoc(kind)
|
||||||
|
out.println("public class $className private () : Number, Comparable<$className> {")
|
||||||
|
|
||||||
|
out.print(" class object")
|
||||||
|
if (kind == PrimitiveType.FLOAT || kind == PrimitiveType.DOUBLE) {
|
||||||
|
out.print(" : FloatingPointConstants<$className>")
|
||||||
|
}
|
||||||
|
out.println(" {}\n")
|
||||||
|
|
||||||
|
generateCompareTo(kind)
|
||||||
|
|
||||||
|
generateBinaryOperators(kind)
|
||||||
|
generateUnaryOperators(kind)
|
||||||
|
generateRangeTo(kind)
|
||||||
|
|
||||||
|
if (kind == PrimitiveType.INT || kind == PrimitiveType.LONG) {
|
||||||
|
generateBitwiseOperators(className)
|
||||||
|
}
|
||||||
|
|
||||||
|
generateConversions()
|
||||||
|
|
||||||
|
out.println("}\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateDoc(kind: PrimitiveType) {
|
||||||
|
out.println("/**")
|
||||||
|
out.println(" * Represents a ${typeDescriptions[kind]}.")
|
||||||
|
out.println(" * On the JVM, non-nullable values of this type are represented as values of the primitive type `${kind.name().toLowerCase()}`.")
|
||||||
|
out.println(" */")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateCompareTo(thisKind: PrimitiveType) {
|
||||||
|
for (otherKind in PrimitiveType.exceptBoolean) {
|
||||||
|
out.print(" public ")
|
||||||
|
if (otherKind == thisKind) out.print("override ")
|
||||||
|
out.println("fun compareTo(other: ${otherKind.capitalized}): Int")
|
||||||
|
}
|
||||||
|
out.println()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateBinaryOperators(thisKind: PrimitiveType) {
|
||||||
|
for (name in binaryOperators) {
|
||||||
|
generateOperator(name, thisKind)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateOperator(name: String, thisKind: PrimitiveType) {
|
||||||
|
for (otherKind in PrimitiveType.exceptBoolean) {
|
||||||
|
val returnType = getOperatorReturnType(thisKind, otherKind)
|
||||||
|
out.println(" public fun $name(other: ${otherKind.capitalized}): $returnType")
|
||||||
|
}
|
||||||
|
out.println()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateRangeTo(thisKind: PrimitiveType) {
|
||||||
|
for (otherKind in PrimitiveType.exceptBoolean) {
|
||||||
|
val returnType = if (otherKind.ordinal() > thisKind.ordinal()) otherKind else thisKind
|
||||||
|
out.println(" public fun rangeTo(other: ${otherKind.capitalized}): ${returnType.capitalized}Range")
|
||||||
|
}
|
||||||
|
out.println()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateUnaryOperators(kind: PrimitiveType) {
|
||||||
|
for (name in unaryOperators) {
|
||||||
|
val returnType = if (kind in listOf(PrimitiveType.SHORT, PrimitiveType.BYTE) &&
|
||||||
|
name in listOf("plus", "minus")) "Int" else kind.capitalized
|
||||||
|
out.println(" public fun $name(): $returnType")
|
||||||
|
}
|
||||||
|
out.println()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateBitwiseOperators(className: String) {
|
||||||
|
for (name in shiftOperators) {
|
||||||
|
out.println(" public fun $name(bits: Int): $className")
|
||||||
|
}
|
||||||
|
for (name in bitwiseOperators) {
|
||||||
|
out.println(" public fun $name(other: $className): $className")
|
||||||
|
}
|
||||||
|
out.println(" public fun inv(): $className")
|
||||||
|
out.println()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun generateConversions() {
|
||||||
|
for (otherKind in PrimitiveType.exceptBoolean) {
|
||||||
|
val name = otherKind.capitalized
|
||||||
|
out.println(" public override fun to$name(): $name")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getOperatorReturnType(kind1: PrimitiveType, kind2: PrimitiveType): String {
|
||||||
|
if (kind1 == PrimitiveType.DOUBLE || kind2 == PrimitiveType.DOUBLE) return "Double"
|
||||||
|
if (kind1 == PrimitiveType.FLOAT || kind2 == PrimitiveType.FLOAT) return "Float"
|
||||||
|
if (kind1 == PrimitiveType.LONG || kind2 == PrimitiveType.LONG) return "Long"
|
||||||
|
return "Int"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user