summaryrefslogtreecommitdiff
path: root/sources/examples/maps.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2003-12-08 16:17:42 +0000
committermichelou <michelou@epfl.ch>2003-12-08 16:17:42 +0000
commit5e87c33e2aaec7a0c9bcd6f257a9a8e4f9664529 (patch)
tree941571431fef1a7273ea82fa2475b99d35ba66ca /sources/examples/maps.scala
parent103888d458fe8cc0ba7c8000c9e2b66923a1b430 (diff)
downloadscala-5e87c33e2aaec7a0c9bcd6f257a9a8e4f9664529.tar.gz
scala-5e87c33e2aaec7a0c9bcd6f257a9a8e4f9664529.tar.bz2
scala-5e87c33e2aaec7a0c9bcd6f257a9a8e4f9664529.zip
- adapted to current Scala version
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]();
+ ()
+ }
+
}