Numbers are hashable

This commit is contained in:
Andrey Breslav
2011-03-17 17:27:21 +03:00
parent 36513aabb9
commit 36292d410b
+18 -1
View File
@@ -9,8 +9,17 @@ virtual class Comparable<in T> {
fun compareTo(other : T) : Int
}
virtual class Hashable {
fun hashCode() : Int
fun equals(other : Any?) : Boolean
}
class Boolean : Comparable<Boolean> {
fun not() : Boolean
fun xor(other : Boolean) : Boolean
fun equals(other : Boolean?) : Boolean
}
class String : Comparable<String> {
@@ -37,7 +46,7 @@ class IntRange<T> : Range<T>, Iterable<T> {
}
class Number {
class Number : Hashable {
val dbl : Double
val flt : Float
val lng : Long
@@ -45,6 +54,14 @@ class Number {
val chr : Char
val sht : Short
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> {