~ remove the PartialFunction flavour for Database: it's only a set of relations\! no-hierarchy
authorAlexandre Bertails <bertails@gmail.com>
Sun, 13 Feb 2011 01:06:00 -0500
branchno-hierarchy
changeset 341 acbc6ab3c0b5
parent 340 fd36781876e2
child 342 05d5a585b109
~ remove the PartialFunction flavour for Database: it's only a set of relations\!
rdb/src/main/scala/RDB.scala
--- 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 }