You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2009/12/05 10:39:07 UTC

svn commit: r887523 - /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastMap.java

Author: srowen
Date: Sat Dec  5 09:39:07 2009
New Revision: 887523

URL: http://svn.apache.org/viewvc?rev=887523&view=rev
Log:
Temporary debugging code in FastMap

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastMap.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastMap.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastMap.java?rev=887523&r1=887522&r2=887523&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastMap.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/FastMap.java Sat Dec  5 09:39:07 2009
@@ -104,6 +104,7 @@
     int hashSize = keys.length;
     int jump = 1 + theHashCode % (hashSize - 2);
     int index = theHashCode % hashSize;
+    int originalIndex = index; // TODO remove
     K currentKey = keys[index];
     while (currentKey != null && (currentKey == REMOVED || !key.equals(currentKey))) {
       if (index < jump) {
@@ -111,6 +112,15 @@
       } else {
         index -= jump;
       }
+      if (index == originalIndex) {
+        // TODO remove
+        System.err.println("Bad FastMap state");
+        System.err.println("Jump: " + jump + ", size: " + keys.length + ", entries " + numEntries);
+        for (int i = 0; i < keys.length; i++) {
+          K theKey = keys[i];
+          System.err.println(theKey == REMOVED ? "REMOVED" : theKey);
+        }
+      }
       currentKey = keys[index];
     }
     return index;