KT-932 split Library.jet to separate files

This commit is contained in:
Alex Tkachman
2012-01-07 18:56:22 +02:00
parent 72a039c311
commit d9a4410fb1
8 changed files with 797 additions and 771 deletions
+84
View File
@@ -0,0 +1,84 @@
package jet
fun Array<T>(val size : Int) : Array<T?>
class Array<T>(val size : Int, init : (Int) -> T) {
fun get(index : Int) : T
fun set(index : Int, value : T) : Unit
fun iterator() : Iterator<T>
val indices : IntRange
}
class ByteArray(val size : Int) {
fun get(index : Int) : Byte
fun set(index : Int, value : Byte) : Unit
fun iterator() : ByteIterator
val indices : IntRange
}
class ShortArray(val size : Int) {
fun get(index : Int) : Short
fun set(index : Int, value : Short) : Unit
fun iterator() : ShortIterator
val indices : IntRange
}
class IntArray(val size : Int) {
fun get(index : Int) : Int
fun set(index : Int, value : Int) : Unit
fun iterator() : IntIterator
val indices : IntRange
}
class LongArray(val size : Int) {
fun get(index : Int) : Long
fun set(index : Int, value : Long) : Unit
fun iterator() : LongIterator
val indices : IntRange
}
class FloatArray(val size : Int) {
fun get(index : Int) : Float
fun set(index : Int, value : Float) : Unit
fun iterator() : FloatIterator
val indices : IntRange
}
class DoubleArray(val size : Int) {
fun get(index : Int) : Double
fun set(index : Int, value : Double) : Unit
fun iterator() : DoubleIterator
val indices : IntRange
}
class CharArray(val size : Int) {
fun get(index : Int) : Char
fun set(index : Int, value : Char) : Unit
fun iterator() : CharIterator
val indices : IntRange
}
class BooleanArray(val size : Int) {
fun get(index : Int) : Boolean
fun set(index : Int, value : Boolean) : Unit
fun iterator() : BooleanIterator
val indices : IntRange
}
+37
View File
@@ -0,0 +1,37 @@
package jet
trait Iterable<out T> {
fun iterator() : Iterator<T>
}
trait ByteIterable : Iterable<Byte> {
override fun iterator() : ByteIterator
}
trait ShortIterable : Iterable<Short> {
override fun iterator() : ShortIterator
}
trait IntIterable : Iterable<Int> {
override fun iterator() : IntIterator
}
trait LongIterable : Iterable<Long> {
override fun iterator() : LongIterator
}
trait FloatIterable : Iterable<Float> {
override fun iterator() : FloatIterator
}
trait DoubleIterable : Iterable<Double> {
override fun iterator() : DoubleIterator
}
trait BooleanIterable : Iterable<Boolean> {
override fun iterator() : BooleanIterator
}
trait CharIterable : Iterable<Char> {
override fun iterator() : CharIterator
}
+73
View File
@@ -0,0 +1,73 @@
package.jet
trait Iterator<out T> {
fun next() : T
val hasNext : Boolean
}
abstract open class ByteIterator() : Iterator<Byte> {
abstract open fun nextByte() : Byte
override fun next() : Byte
}
abstract open class ShortIterator() : Iterator<Short> {
abstract open fun nextShort() : Short
override fun next() : Short
}
abstract open class CharIterator() : Iterator<Char> {
abstract open fun nextChar() : Char
override fun next() : Char
}
abstract open class IntIterator() : Iterator<Int> {
abstract open fun nextInt() : Int
override fun next() : Int
}
abstract open class LongIterator() : Iterator<Long> {
abstract open fun nextLong() : Long
override fun next() : Long
}
abstract open class FloatIterator() : Iterator<Float> {
abstract open fun nextFloat() : Float
override fun next() : Float
}
abstract open class DoubleIterator() : Iterator<Double> {
abstract open fun nextDouble() : Double
override fun next() : Double
}
abstract open class BooleanIterator() : Iterator<Boolean> {
abstract open fun nextBoolean() : Boolean
override fun next() : Boolean
}
fun <T> Iterator<T>.iterator() : Iterator<T>
fun ByteIterator.iterator() : ByteIterator
fun ShortIterator.iterator() : ShortIterator
fun CharIterator.iterator() : CharIterator
fun IntIterator.iterator() : IntIterator
fun BooleanIterator.iterator() : BooleanIterator
fun DoubleIterator.iterator() : DoubleIterator
fun FloatIterator.iterator() : FloatIterator
fun LongIterator.iterator() : LongIterator
-759
View File
@@ -22,196 +22,6 @@ fun <T : Any> T?.sure() : T
fun String?.plus(other: Any?) : String
fun <T> Iterator<T>.iterator() : Iterator<T>
trait Iterator<out T> {
fun next() : T
val hasNext : Boolean
}
fun ByteIterator.iterator() : ByteIterator
abstract open class ByteIterator() : Iterator<Byte> {
abstract open fun nextByte() : Byte
override fun next() : Byte
}
fun ShortIterator.iterator() : ShortIterator
abstract open class ShortIterator() : Iterator<Short> {
abstract open fun nextShort() : Short
override fun next() : Short
}
fun CharIterator.iterator() : CharIterator
abstract open class CharIterator() : Iterator<Char> {
abstract open fun nextChar() : Char
override fun next() : Char
}
fun IntIterator.iterator() : IntIterator
abstract open class IntIterator() : Iterator<Int> {
abstract open fun nextInt() : Int
override fun next() : Int
}
fun LongIterator.iterator() : LongIterator
abstract open class LongIterator() : Iterator<Long> {
abstract open fun nextLong() : Long
override fun next() : Long
}
fun FloatIterator.iterator() : FloatIterator
abstract open class FloatIterator() : Iterator<Float> {
abstract open fun nextFloat() : Float
override fun next() : Float
}
fun DoubleIterator.iterator() : DoubleIterator
abstract open class DoubleIterator() : Iterator<Double> {
abstract open fun nextDouble() : Double
override fun next() : Double
}
fun BooleanIterator.iterator() : BooleanIterator
abstract open class BooleanIterator() : Iterator<Boolean> {
abstract open fun nextBoolean() : Boolean
override fun next() : Boolean
}
trait Iterable<out T> {
fun iterator() : Iterator<T>
}
trait ByteIterable : Iterable<Byte> {
override fun iterator() : ByteIterator
}
trait ShortIterable : Iterable<Short> {
override fun iterator() : ShortIterator
}
trait IntIterable : Iterable<Int> {
override fun iterator() : IntIterator
}
trait LongIterable : Iterable<Long> {
override fun iterator() : LongIterator
}
trait FloatIterable : Iterable<Float> {
override fun iterator() : FloatIterator
}
trait DoubleIterable : Iterable<Double> {
override fun iterator() : DoubleIterator
}
trait BooleanIterable : Iterable<Boolean> {
override fun iterator() : BooleanIterator
}
trait CharIterable : Iterable<Char> {
override fun iterator() : CharIterator
}
fun Array<T>(val size : Int) : Array<T?>
class Array<T>(val size : Int, init : (Int) -> T) {
fun get(index : Int) : T
fun set(index : Int, value : T) : Unit
fun iterator() : Iterator<T>
val indices : IntRange
}
class ByteArray(val size : Int) {
fun get(index : Int) : Byte
fun set(index : Int, value : Byte) : Unit
fun iterator() : ByteIterator
val indices : IntRange
}
class ShortArray(val size : Int) {
fun get(index : Int) : Short
fun set(index : Int, value : Short) : Unit
fun iterator() : ShortIterator
val indices : IntRange
}
class IntArray(val size : Int) {
fun get(index : Int) : Int
fun set(index : Int, value : Int) : Unit
fun iterator() : IntIterator
val indices : IntRange
}
class LongArray(val size : Int) {
fun get(index : Int) : Long
fun set(index : Int, value : Long) : Unit
fun iterator() : LongIterator
val indices : IntRange
}
class FloatArray(val size : Int) {
fun get(index : Int) : Float
fun set(index : Int, value : Float) : Unit
fun iterator() : FloatIterator
val indices : IntRange
}
class DoubleArray(val size : Int) {
fun get(index : Int) : Double
fun set(index : Int, value : Double) : Unit
fun iterator() : DoubleIterator
val indices : IntRange
}
class CharArray(val size : Int) {
fun get(index : Int) : Char
fun set(index : Int, value : Char) : Unit
fun iterator() : CharIterator
val indices : IntRange
}
class BooleanArray(val size : Int) {
fun get(index : Int) : Boolean
fun set(index : Int, value : Boolean) : Unit
fun iterator() : BooleanIterator
val indices : IntRange
}
trait Comparable<in T> {
fun compareTo(other : T) : Int
}
@@ -252,573 +62,4 @@ class String() : Comparable<String> {
fun trim(): String
}
trait Range<in T : Comparable<T>> {
fun contains(item : T) : Boolean
}
class IntRange(val start : Int, val size : Int) : Range<Int>, IntIterable {
fun iterator () : IntIterator
fun contains (elem: Int) : Boolean
val end : Int
fun minus() : IntRange
fun step(step: Int) : IntIterator
val isReversed : Boolean
}
class LongRange(val start : Long, val size : Long) : Range<Long>, LongIterable {
fun iterator () : LongIterator
fun contains (elem: Long) : Boolean
val end : Long
fun minus() : LongRange
fun step(step: Long) : LongIterator
val isReversed : Boolean
}
class ByteRange(val start : Byte, val size : Int) : Range<Byte>, ByteIterable {
fun iterator () : ByteIterator
fun contains (elem: Byte) : Boolean
val end : Byte
fun minus() : ByteRange
fun step(step: Int) : ByteIterator
val isReversed : Boolean
}
class ShortRange(val start : Short, val size : Int) : Range<Short>, ShortIterable {
fun iterator () : ShortIterator
fun contains (elem: Byte) : Boolean
val end : Short
fun minus() : ShortRange
fun step(step: Int) : ShortIterator
val isReversed : Boolean
}
class CharRange(val start : Char, val size : Int) : Range<Char>, CharIterable {
fun iterator () : CharIterator
fun contains (elem: Char) : Boolean
val end : Char
fun minus() : CharRange
fun step(step: Int) : CharIterator
val isReversed : Boolean
}
class FloatRange(val start : Float, val size : Float) : Range<Float> {
fun contains (elem: Float) : Boolean
val end : Float
fun minus() : FloatRange
fun step(step: Float) : FloatIterator
val isReversed : Boolean
}
class DoubleRange(val start : Double, val size : Double) : Range<Double> {
fun contains (elem: Double) : Boolean
val end : Double
fun minus() : DoubleRange
fun step(step: Double) : DoubleIterator
val isReversed : Boolean
}
abstract class Number : Hashable {
abstract val dbl : Double
abstract val flt : Float
abstract val lng : Long
abstract val int : Int
abstract val chr : Char
abstract val sht : Short
abstract val byt : Byte
// fun equals(other : Double) : Boolean
// fun equals(other : Float) : Boolean
// fun equals(other : Long) : Boolean
// fun equals(other : Byte) : Boolean
// fun equals(other : Int) : Boolean
// fun equals(other : Short) : Boolean
// fun equals(other : Char) : Boolean
}
class Double : Number, Comparable<Double> {
override fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Double
fun plus(other : Long) : Double
fun plus(other : Int) : Double
fun plus(other : Short) : Double
fun plus(other : Byte) : Double
fun plus(other : Char) : Double
fun minus(other : Double) : Double
fun minus(other : Float) : Double
fun minus(other : Long) : Double
fun minus(other : Int) : Double
fun minus(other : Short) : Double
fun minus(other : Byte) : Double
fun minus(other : Char) : Double
fun times(other : Double) : Double
fun times(other : Float) : Double
fun times(other : Long) : Double
fun times(other : Int) : Double
fun times(other : Short) : Double
fun times(other : Byte) : Double
fun times(other : Char) : Double
fun div(other : Double) : Double
fun div(other : Float) : Double
fun div(other : Long) : Double
fun div(other : Int) : Double
fun div(other : Short) : Double
fun div(other : Byte) : Double
fun div(other : Char) : Double
fun mod(other : Double) : Double
fun mod(other : Float) : Double
fun mod(other : Long) : Double
fun mod(other : Int) : Double
fun mod(other : Short) : Double
fun mod(other : Byte) : Double
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : DoubleRange
fun rangeTo(other : Long) : DoubleRange
fun rangeTo(other : Int) : DoubleRange
fun rangeTo(other : Short) : DoubleRange
fun rangeTo(other : Byte) : DoubleRange
fun rangeTo(other : Char) : DoubleRange
fun inc() : Double
fun dec() : Double
fun plus() : Double
fun minus() : Double
}
class Float : Number, Comparable<Float> {
fun compareTo(other : Double) : Int
override fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Float
fun plus(other : Int) : Float
fun plus(other : Short) : Float
fun plus(other : Byte) : Float
fun plus(other : Char) : Float
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Float
fun minus(other : Int) : Float
fun minus(other : Short) : Float
fun minus(other : Byte) : Float
fun minus(other : Char) : Float
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Float
fun times(other : Int) : Float
fun times(other : Short) : Float
fun times(other : Byte) : Float
fun times(other : Char) : Float
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Float
fun div(other : Int) : Float
fun div(other : Short) : Float
fun div(other : Byte) : Float
fun div(other : Char) : Float
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Float
fun mod(other : Int) : Float
fun mod(other : Short) : Float
fun mod(other : Byte) : Float
fun mod(other : Char) : Float
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : DoubleRange
fun rangeTo(other : Int) : DoubleRange
fun rangeTo(other : Short) : FloatRange
fun rangeTo(other : Byte) : FloatRange
fun rangeTo(other : Char) : FloatRange
fun inc() : Float
fun dec() : Float
fun plus() : Float
fun minus() : Float
}
class Long : Number, Comparable<Long> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
override fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Long
fun plus(other : Short) : Long
fun plus(other : Byte) : Long
fun plus(other : Char) : Long
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Long
fun minus(other : Short) : Long
fun minus(other : Byte) : Long
fun minus(other : Char) : Long
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Long
fun times(other : Short) : Long
fun times(other : Byte) : Long
fun times(other : Char) : Long
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Long
fun div(other : Short) : Long
fun div(other : Byte) : Long
fun div(other : Char) : Long
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Long
fun mod(other : Short) : Long
fun mod(other : Byte) : Long
fun mod(other : Char) : Long
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : LongRange
fun rangeTo(other : Short) : LongRange
fun rangeTo(other : Byte) : LongRange
fun rangeTo(other : Char) : LongRange
fun inc() : Long
fun dec() : Long
fun plus() : Long
fun minus() : Long
fun shl(bits : Int) : Long
fun shr(bits : Int) : Long
fun ushr(bits : Int) : Long
fun and(other : Long) : Long
fun or(other : Long) : Long
fun xor(other : Long) : Long
fun inv() : Long
}
class Int : Number, Comparable<Int> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
override fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : IntRange
fun rangeTo(other : Byte) : IntRange
fun rangeTo(other : Char) : IntRange
fun inc() : Int
fun dec() : Int
fun plus() : Int
fun minus() : Int
fun shl(bits : Int) : Int
fun shr(bits : Int) : Int
fun ushr(bits : Int) : Int
fun and(other : Int) : Int
fun or(other : Int) : Int
fun xor(other : Int) : Int
fun inv() : Int
}
class Char : Number, Comparable<Char> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
override fun compareTo(other : Char) : Int
fun compareTo(other : Byte) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
// fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
// fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
// fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
// fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : ShortRange
fun rangeTo(other : Byte) : CharRange
fun rangeTo(other : Char) : CharRange
fun inc() : Char
fun dec() : Char
fun plus() : Int
fun minus() : Int
}
class Short : Number, Comparable<Short> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
override fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : ShortRange
fun rangeTo(other : Byte) : ShortRange
fun rangeTo(other : Char) : IntRange
fun inc() : Short
fun dec() : Short
fun plus() : Short
fun minus() : Short
}
class Byte : Number, Comparable<Byte> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Char) : Int
override fun compareTo(other : Byte) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : ShortRange
fun rangeTo(other : Byte) : ByteRange
fun rangeTo(other : Char) : IntRange
fun inc() : Byte
fun dec() : Byte
fun plus() : Byte
fun minus() : Byte
}
+474
View File
@@ -0,0 +1,474 @@
package jet
abstract class Number : Hashable {
abstract val dbl : Double
abstract val flt : Float
abstract val lng : Long
abstract val int : Int
abstract val chr : Char
abstract val sht : Short
abstract val byt : Byte
// fun equals(other : Double) : Boolean
// fun equals(other : Float) : Boolean
// fun equals(other : Long) : Boolean
// fun equals(other : Byte) : Boolean
// fun equals(other : Int) : Boolean
// fun equals(other : Short) : Boolean
// fun equals(other : Char) : Boolean
}
class Double : Number, Comparable<Double> {
override fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Double
fun plus(other : Long) : Double
fun plus(other : Int) : Double
fun plus(other : Short) : Double
fun plus(other : Byte) : Double
fun plus(other : Char) : Double
fun minus(other : Double) : Double
fun minus(other : Float) : Double
fun minus(other : Long) : Double
fun minus(other : Int) : Double
fun minus(other : Short) : Double
fun minus(other : Byte) : Double
fun minus(other : Char) : Double
fun times(other : Double) : Double
fun times(other : Float) : Double
fun times(other : Long) : Double
fun times(other : Int) : Double
fun times(other : Short) : Double
fun times(other : Byte) : Double
fun times(other : Char) : Double
fun div(other : Double) : Double
fun div(other : Float) : Double
fun div(other : Long) : Double
fun div(other : Int) : Double
fun div(other : Short) : Double
fun div(other : Byte) : Double
fun div(other : Char) : Double
fun mod(other : Double) : Double
fun mod(other : Float) : Double
fun mod(other : Long) : Double
fun mod(other : Int) : Double
fun mod(other : Short) : Double
fun mod(other : Byte) : Double
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : DoubleRange
fun rangeTo(other : Long) : DoubleRange
fun rangeTo(other : Int) : DoubleRange
fun rangeTo(other : Short) : DoubleRange
fun rangeTo(other : Byte) : DoubleRange
fun rangeTo(other : Char) : DoubleRange
fun inc() : Double
fun dec() : Double
fun plus() : Double
fun minus() : Double
}
class Float : Number, Comparable<Float> {
fun compareTo(other : Double) : Int
override fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Float
fun plus(other : Int) : Float
fun plus(other : Short) : Float
fun plus(other : Byte) : Float
fun plus(other : Char) : Float
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Float
fun minus(other : Int) : Float
fun minus(other : Short) : Float
fun minus(other : Byte) : Float
fun minus(other : Char) : Float
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Float
fun times(other : Int) : Float
fun times(other : Short) : Float
fun times(other : Byte) : Float
fun times(other : Char) : Float
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Float
fun div(other : Int) : Float
fun div(other : Short) : Float
fun div(other : Byte) : Float
fun div(other : Char) : Float
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Float
fun mod(other : Int) : Float
fun mod(other : Short) : Float
fun mod(other : Byte) : Float
fun mod(other : Char) : Float
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : DoubleRange
fun rangeTo(other : Int) : DoubleRange
fun rangeTo(other : Short) : FloatRange
fun rangeTo(other : Byte) : FloatRange
fun rangeTo(other : Char) : FloatRange
fun inc() : Float
fun dec() : Float
fun plus() : Float
fun minus() : Float
}
class Long : Number, Comparable<Long> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
override fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Long
fun plus(other : Short) : Long
fun plus(other : Byte) : Long
fun plus(other : Char) : Long
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Long
fun minus(other : Short) : Long
fun minus(other : Byte) : Long
fun minus(other : Char) : Long
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Long
fun times(other : Short) : Long
fun times(other : Byte) : Long
fun times(other : Char) : Long
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Long
fun div(other : Short) : Long
fun div(other : Byte) : Long
fun div(other : Char) : Long
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Long
fun mod(other : Short) : Long
fun mod(other : Byte) : Long
fun mod(other : Char) : Long
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : LongRange
fun rangeTo(other : Short) : LongRange
fun rangeTo(other : Byte) : LongRange
fun rangeTo(other : Char) : LongRange
fun inc() : Long
fun dec() : Long
fun plus() : Long
fun minus() : Long
fun shl(bits : Int) : Long
fun shr(bits : Int) : Long
fun ushr(bits : Int) : Long
fun and(other : Long) : Long
fun or(other : Long) : Long
fun xor(other : Long) : Long
fun inv() : Long
}
class Int : Number, Comparable<Int> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
override fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : IntRange
fun rangeTo(other : Byte) : IntRange
fun rangeTo(other : Char) : IntRange
fun inc() : Int
fun dec() : Int
fun plus() : Int
fun minus() : Int
fun shl(bits : Int) : Int
fun shr(bits : Int) : Int
fun ushr(bits : Int) : Int
fun and(other : Int) : Int
fun or(other : Int) : Int
fun xor(other : Int) : Int
fun inv() : Int
}
class Char : Number, Comparable<Char> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
override fun compareTo(other : Char) : Int
fun compareTo(other : Byte) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
// fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
// fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
// fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
// fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : ShortRange
fun rangeTo(other : Byte) : CharRange
fun rangeTo(other : Char) : CharRange
fun inc() : Char
fun dec() : Char
fun plus() : Int
fun minus() : Int
}
class Short : Number, Comparable<Short> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
override fun compareTo(other : Short) : Int
fun compareTo(other : Byte) : Int
fun compareTo(other : Char) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : ShortRange
fun rangeTo(other : Byte) : ShortRange
fun rangeTo(other : Char) : IntRange
fun inc() : Short
fun dec() : Short
fun plus() : Short
fun minus() : Short
}
class Byte : Number, Comparable<Byte> {
fun compareTo(other : Double) : Int
fun compareTo(other : Float) : Int
fun compareTo(other : Long) : Int
fun compareTo(other : Int) : Int
fun compareTo(other : Short) : Int
fun compareTo(other : Char) : Int
override fun compareTo(other : Byte) : Int
fun plus(other : Double) : Double
fun plus(other : Float) : Float
fun plus(other : Long) : Long
fun plus(other : Int) : Int
fun plus(other : Short) : Int
fun plus(other : Byte) : Int
fun plus(other : Char) : Int
fun minus(other : Double) : Double
fun minus(other : Float) : Float
fun minus(other : Long) : Long
fun minus(other : Int) : Int
fun minus(other : Short) : Int
fun minus(other : Byte) : Int
fun minus(other : Char) : Int
fun times(other : Double) : Double
fun times(other : Float) : Float
fun times(other : Long) : Long
fun times(other : Int) : Int
fun times(other : Short) : Int
fun times(other : Byte) : Int
fun times(other : Char) : Int
fun div(other : Double) : Double
fun div(other : Float) : Float
fun div(other : Long) : Long
fun div(other : Int) : Int
fun div(other : Short) : Int
fun div(other : Byte) : Int
fun div(other : Char) : Int
fun mod(other : Double) : Double
fun mod(other : Float) : Float
fun mod(other : Long) : Long
fun mod(other : Int) : Int
fun mod(other : Short) : Int
fun mod(other : Byte) : Int
fun mod(other : Char) : Int
fun rangeTo(other : Double) : DoubleRange
fun rangeTo(other : Float) : FloatRange
fun rangeTo(other : Long) : LongRange
fun rangeTo(other : Int) : IntRange
fun rangeTo(other : Short) : ShortRange
fun rangeTo(other : Byte) : ByteRange
fun rangeTo(other : Char) : IntRange
fun inc() : Byte
fun dec() : Byte
fun plus() : Byte
fun minus() : Byte
}
+99
View File
@@ -0,0 +1,99 @@
package jet
trait Range<in T : Comparable<T>> {
fun contains(item : T) : Boolean
}
class IntRange(val start : Int, val size : Int) : Range<Int>, IntIterable {
fun iterator () : IntIterator
fun contains (elem: Int) : Boolean
val end : Int
fun minus() : IntRange
fun step(step: Int) : IntIterator
val isReversed : Boolean
}
class LongRange(val start : Long, val size : Long) : Range<Long>, LongIterable {
fun iterator () : LongIterator
fun contains (elem: Long) : Boolean
val end : Long
fun minus() : LongRange
fun step(step: Long) : LongIterator
val isReversed : Boolean
}
class ByteRange(val start : Byte, val size : Int) : Range<Byte>, ByteIterable {
fun iterator () : ByteIterator
fun contains (elem: Byte) : Boolean
val end : Byte
fun minus() : ByteRange
fun step(step: Int) : ByteIterator
val isReversed : Boolean
}
class ShortRange(val start : Short, val size : Int) : Range<Short>, ShortIterable {
fun iterator () : ShortIterator
fun contains (elem: Byte) : Boolean
val end : Short
fun minus() : ShortRange
fun step(step: Int) : ShortIterator
val isReversed : Boolean
}
class CharRange(val start : Char, val size : Int) : Range<Char>, CharIterable {
fun iterator () : CharIterator
fun contains (elem: Char) : Boolean
val end : Char
fun minus() : CharRange
fun step(step: Int) : CharIterator
val isReversed : Boolean
}
class FloatRange(val start : Float, val size : Float) : Range<Float> {
fun contains (elem: Float) : Boolean
val end : Float
fun minus() : FloatRange
fun step(step: Float) : FloatIterator
val isReversed : Boolean
}
class DoubleRange(val start : Double, val size : Double) : Range<Double> {
fun contains (elem: Double) : Boolean
val end : Double
fun minus() : DoubleRange
fun step(step: Double) : DoubleIterator
val isReversed : Boolean
}
@@ -9,13 +9,16 @@ import org.jetbrains.jet.lang.Configuration;
import org.jetbrains.jet.lang.JetSemanticServices;
import org.jetbrains.jet.lang.cfg.pseudocode.JetControlFlowDataTraceFactory;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.JetDeclaration;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetObjectDeclaration;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* @author abreslav
@@ -93,14 +96,18 @@ public class TopDownAnalyzer {
@NotNull BindingTrace trace,
@NotNull WritableScope outerScope,
@NotNull NamespaceDescriptorImpl standardLibraryNamespace,
@NotNull JetFile file) {
@NotNull List<JetFile> files) {
TopDownAnalysisContext context = new TopDownAnalysisContext(semanticServices, trace, Predicates.<PsiFile>alwaysTrue(), Configuration.EMPTY, false);
context.getNamespaceDescriptors().put(file, standardLibraryNamespace);
context.getNamespaceScopes().put(file, standardLibraryNamespace.getMemberScope());
ArrayList<JetDeclaration> toAnalyze = new ArrayList<JetDeclaration>();
for(JetFile file : files) {
context.getNamespaceDescriptors().put(file, standardLibraryNamespace);
context.getNamespaceScopes().put(file, standardLibraryNamespace.getMemberScope());
toAnalyze.addAll(file.getDeclarations());
}
// context.getDeclaringScopes().put(file, outerScope);
context.setAnalyzingBootstrapLibrary(true);
doProcess(context, outerScope, standardLibraryNamespace, file.getDeclarations(), JetControlFlowDataTraceFactory.EMPTY);
doProcess(context, outerScope, standardLibraryNamespace, toAnalyze, JetControlFlowDataTraceFactory.EMPTY);
}
public static void processObject(
@@ -21,9 +21,7 @@ import org.jetbrains.jet.plugin.JetFileType;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
* @author abreslav
@@ -126,11 +124,24 @@ public class JetStandardLibrary {
private JetStandardLibrary(@NotNull Project project) {
// TODO : review
InputStream stream = JetStandardClasses.class.getClassLoader().getResourceAsStream("jet/Library.jet");
List<String> libraryFiles = Arrays.asList(
"Library.jet",
"Numbers.jet",
"Ranges.jet",
"Iterables.jet",
"Iterators.jet",
"Arrays.jet"
);
try {
//noinspection IOResourceOpenedButNotSafelyClosed
JetFile file = (JetFile) PsiFileFactory.getInstance(project).createFileFromText("Library.jet",
JetFileType.INSTANCE, FileUtil.loadTextAndClose(new InputStreamReader(stream)));
List<JetFile> files = new LinkedList<JetFile>();
for(String fileName : libraryFiles) {
InputStream stream = JetStandardClasses.class.getClassLoader().getResourceAsStream("jet/" + fileName);
//noinspection IOResourceOpenedButNotSafelyClosed
JetFile file = (JetFile) PsiFileFactory.getInstance(project).createFileFromText(fileName,
JetFileType.INSTANCE, FileUtil.loadTextAndClose(new InputStreamReader(stream)));
files.add(file);
}
JetSemanticServices bootstrappingSemanticServices = JetSemanticServices.createSemanticServices(this);
BindingTraceContext bindingTraceContext = new BindingTraceContext();
@@ -138,7 +149,7 @@ public class JetStandardLibrary {
writableScope.changeLockLevel(WritableScope.LockLevel.BOTH);
// this.libraryScope = bootstrappingTDA.process(JetStandardClasses.STANDARD_CLASSES, file.getRootNamespace().getDeclarations());
// bootstrappingTDA.process(writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, file.getRootNamespace().getDeclarations());
TopDownAnalyzer.processStandardLibraryNamespace(bootstrappingSemanticServices, bindingTraceContext, writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, file);
TopDownAnalyzer.processStandardLibraryNamespace(bootstrappingSemanticServices, bindingTraceContext, writableScope, JetStandardClasses.STANDARD_CLASSES_NAMESPACE, files);
// this.libraryScope = JetStandardClasses.STANDARD_CLASSES_NAMESPACE.getMemberScope();
AnalyzingUtils.throwExceptionOnErrors(bindingTraceContext.getBindingContext());