~ remove the PartialFunction flavour for Database: it's only a set of relations\!
--- a/rdb/src/main/scala/RDB.scala Sun Feb 13 00:55:48 2011 -0500
+++ b/rdb/src/main/scala/RDB.scala Sun Feb 13 01:06:00 2011 -0500
@@ -6,9 +6,9 @@
object RDB {
/**
- * a Database maps a relation name to the actual Relation
+ * a Database defines a set of relations
*/
- case class Database(private val m:Map[RelName, Relation]) extends PartialFunction[RelName, Relation] {
+ case class Database(private val m:Map[RelName, Relation]) {
// tricky and evil
// when the Database is created, it can go through all the foreign key and set the database field
// this way, a Target can know directly the Relation without using Database
@@ -20,8 +20,7 @@
}
def apply(rn:RelName) = m(rn)
- def isDefinedAt(rn:RelName) = m isDefinedAt rn
- /** returns all the relations */
+ /** returns all the relations in this database */
def relations:Set[Relation] = m.values.toSet
/** return all the relations with at least on Candidate Key */
def indexables = m collect { case (rn, r) if r.isIndexable => r }