summaryrefslogtreecommitdiff
path: root/sources/examples/maps.scala
diff options
context:
space:
mode:
Diffstat (limited to 'sources/examples/maps.scala')
-rw-r--r--sources/examples/maps.scala28
1 files changed, 27 insertions, 1 deletions
diff --git a/sources/examples/maps.scala b/sources/examples/maps.scala
index 2f9471d2dd..a5b2348f95 100644
--- a/sources/examples/maps.scala
+++ b/sources/examples/maps.scala
@@ -1,4 +1,8 @@
-module maps {
+package examples;
+
+object maps {
+
+ import scala.collection.immutable._;
trait MapStruct[kt, vt] {
trait Map with Function1[kt, vt] {
@@ -146,6 +150,28 @@ module maps {
}
val empty = new MutMap(null, null);
}
+
+ class Date(y: Int, m: Int, d: Int) with Ord[Date] {
+ def year = y, month = m, day = d;
+
+ def <(that: Date): Boolean = {
+ (year < that.year) ||
+ (year == that.year && month < that.month) ||
+ (month == that.month && day < that.day)
+ }
+
+ override def equals(that: Any): Boolean =
+ that.isInstanceOf[Date] && {
+ val o = that.asInstanceOf[Date];
+ day == o.day && month == o.month && year == o.year
+ }
+ }
+
+ def main(args: Array[String]) = {
+ val t = new OOBinTree[Date, String]();
+ ()
+ }
+
}