Hi,
I get the following error when trying to compile this:
Btree.scala:9: error: could not find implicit value for parameter ordering: Ordering[K] abstract class Node[K,V] extends TreeMap[K,V]
TreeMap is supposed to accept an implicit Ordering[A] val which I provide. Perhaps the implicit parameter needs to be in object Tester where the Btree(TreeMap) is instantiated? I would prefer to keep the implicit declaration inside of the Btree class because I would like Ordering to have a type K that implements Comparable[K]. Make sense?
package disttree {
import scala.collection.immutable.TreeMap
class Btree[K <: Comparable[K],V](fanout:Int) {
implicit object DefaultOrder extends Ordering[K] {
def compare(k1: K, k2: K) = k1 compareTo k2
}
abstract class Node[K,V] extends TreeMap[K,V]
class InnerNode[K,V] extends Node[K,V]
class LeafNode[K,V] extends Node[K,V]
val root = new InnerNode[K,V]()
def search(n: Node[K,V], key: K): Option[(K,V)] = {
return n.find(_ == key)
}
def insert(key: K, value: V) { }
def delete(key: K) { }
}
}
import disttree._;
object Tester {
def main(args: List[String]) = {
var t = new Btree[Int, Any](2)
t.insert(1, "goodbye")
Console.println(t)
}
}