prefer abstract datatype -- in accordance to ML version;
authorwenzelm
Fri, 28 Feb 2014 12:04:40 +0100
changeset 55802 f7ceebe2f1b5
parent 55801 28b59620f0d0
child 55803 74d3fe9031d8
prefer abstract datatype -- in accordance to ML version;
src/Pure/General/sha1.scala
--- a/src/Pure/General/sha1.scala	Fri Feb 28 11:58:26 2014 +0100
+++ b/src/Pure/General/sha1.scala	Fri Feb 28 12:04:40 2014 +0100
@@ -14,8 +14,14 @@
 
 object SHA1
 {
-  sealed case class Digest(rep: String)
+  final class Digest private[SHA1](val rep: String)
   {
+    override def hashCode: Int = rep.hashCode
+    override def equals(that: Any): Boolean =
+      that match {
+        case other: Digest => rep == other.rep
+        case _ => false
+      }
     override def toString: String = rep
   }
 
@@ -27,7 +33,7 @@
       if (i < 16) result += '0'
       result ++= Integer.toHexString(i)
     }
-    Digest(result.toString)
+    new Digest(result.toString)
   }
 
   def digest(file: JFile): Digest =