sample update: constructor doesn't have fun keyword before this

This commit is contained in:
Maxim Shafirov
2011-01-02 20:12:25 +03:00
parent b7493012af
commit b80460746a
+3 -3
View File
@@ -2,7 +2,7 @@ class BinaryHeap<T> : IPriorityQueue<T> {
private val data : IMutableList<T> private val data : IMutableList<T>
private val compare : Comparison<T> private val compare : Comparison<T>
fun this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) { this(data : IIterable<T>, compare : Comparison<T> = naturalOrder<T>) {
this.compare = compare this.compare = compare
this.data = ArrayList(data) this.data = ArrayList(data)
siftDown(* this.data.size / 2 .. 0) siftDown(* this.data.size / 2 .. 0)
@@ -13,12 +13,12 @@ class BinaryHeap<T> : IPriorityQueue<T> {
*/ */
} }
fun this(compare : Comparison<T>) { this(compare : Comparison<T>) {
this.compare = compare this.compare = compare
this.data = ArrayList() this.data = ArrayList()
} }
fun this() { this() {
this.data = ArrayList() this.data = ArrayList()
Assert(T is IComparable<T>) Assert(T is IComparable<T>)
this.comparator = naturalOrder<T> this.comparator = naturalOrder<T>