summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-02-29 16:12:59 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-02-29 16:12:59 +0000
commitfaf3c9732d4adcec6bb7d7f922af4b3cd3a067ff (patch)
tree85511d383236e10e326a1fc88ab87c1d93e75564 /src
parent941b8cc5604b2cbc15c8de55fa84fc62146408a4 (diff)
downloadscala-faf3c9732d4adcec6bb7d7f922af4b3cd3a067ff.tar.gz
scala-faf3c9732d4adcec6bb7d7f922af4b3cd3a067ff.tar.bz2
scala-faf3c9732d4adcec6bb7d7f922af4b3cd3a067ff.zip
Added a definition of equals() and hashCode to ...
Added a definition of equals() and hashCode to Enumeration.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/Enumeration.scala4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index 81d956c647..9c91996d23 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -162,6 +162,10 @@ abstract class Enumeration(initial: Int, names: String*) {
/** the id and bit location of this enumeration value */
def id: Int
override def compare(that: Value): Int = this.id - that.id
+ override def equals(other : Any) : Boolean =
+ other match { case that : Value => compare(that) == 0
+ case _ => false }
+ override def hashCode : Int = id.hashCode
/** this enumeration value as an <code>Int</code> bit mask.
* @throws IllegalArgumentException if <code>id</code> is greater than 31
*/