Numbers are hashable
This commit is contained in:
@@ -9,8 +9,17 @@ virtual class Comparable<in T> {
|
|||||||
fun compareTo(other : T) : Int
|
fun compareTo(other : T) : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual class Hashable {
|
||||||
|
fun hashCode() : Int
|
||||||
|
fun equals(other : Any?) : Boolean
|
||||||
|
}
|
||||||
|
|
||||||
class Boolean : Comparable<Boolean> {
|
class Boolean : Comparable<Boolean> {
|
||||||
fun not() : Boolean
|
fun not() : Boolean
|
||||||
|
|
||||||
|
fun xor(other : Boolean) : Boolean
|
||||||
|
|
||||||
|
fun equals(other : Boolean?) : Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
class String : Comparable<String> {
|
class String : Comparable<String> {
|
||||||
@@ -37,7 +46,7 @@ class IntRange<T> : Range<T>, Iterable<T> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Number {
|
class Number : Hashable {
|
||||||
val dbl : Double
|
val dbl : Double
|
||||||
val flt : Float
|
val flt : Float
|
||||||
val lng : Long
|
val lng : Long
|
||||||
@@ -45,6 +54,14 @@ class Number {
|
|||||||
val chr : Char
|
val chr : Char
|
||||||
val sht : Short
|
val sht : Short
|
||||||
val byt : Byte
|
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> {
|
class Double : Number, Comparable<Double> {
|
||||||
|
|||||||
Reference in New Issue
Block a user