Revision: 445
http://assorted.svn.sourceforge.net/assorted/?rev=445&view=rev
Author: yangzhang
Date: 2008-02-14 20:04:44 -0800 (Thu, 14 Feb 2008)
Log Message:
-----------
added warnings if something hashed to 0
Modified Paths:
--------------
hash-dist/trunk/src/HashDist.scala
Modified: hash-dist/trunk/src/HashDist.scala
===================================================================
--- hash-dist/trunk/src/HashDist.scala 2008-02-15 04:04:38 UTC (rev 444)
+++ hash-dist/trunk/src/HashDist.scala 2008-02-15 04:04:44 UTC (rev 445)
@@ -43,8 +43,15 @@
// For each line, hash its way down the tree.
for (line <- untilNull(Console.readLine)) {
+ if (line.length == 0) println("XXX")
val xs = line.toCharArray map (_ toInt)
- val path = (for ((h,n) <- hs) yield mod(h(xs), n)).toArray
+ val path = (
+ for ((h,n) <- hs) yield {
+ val hv = h(xs)
+ if (hv == 0) println("hashed to 0: " + line + " / " + xs.toList)
+ mod(hv, n)
+ }
+ ) toArray
val counts: Array[Int] = tree get path.toStream.init
counts(path.last) += 1
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|