mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeast...@apache.org
Subject svn commit: r785207 - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/matrix/AbstractVector.java test/java/org/apache/mahout/matrix/VectorTest.java
Date Tue, 16 Jun 2009 13:33:13 GMT
Author: jeastman
Date: Tue Jun 16 13:33:13 2009
New Revision: 785207

URL: http://svn.apache.org/viewvc?rev=785207&view=rev
Log:
MAHOUT-65: marked AbstractVector bindings as transient. Updated unit tests

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/AbstractVector.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/AbstractVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/AbstractVector.java?rev=785207&r1=785206&r2=785207&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/AbstractVector.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/AbstractVector.java Tue
Jun 16 13:33:13 2009
@@ -32,9 +32,10 @@
 public abstract class AbstractVector implements Vector {
 
   /**
-   * User-settable mapping between String labels and Integer indices
+   * User-settable mapping between String labels and Integer indices. Marked
+   * transient so that it will not be serialized with each vector instance.
    */
-  private Map<String, Integer> bindings;
+  private transient Map<String, Integer> bindings;
 
   /**
    * Subclasses must override to return an appropriately sparse or dense result

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java?rev=785207&r1=785206&r2=785207&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java Tue Jun
16 13:33:13 2009
@@ -319,9 +319,14 @@
     Gson gson = builder.create();
     String json = gson.toJson(test, vectorType);
     Vector test1 = gson.fromJson(json, vectorType);
-    assertEquals("Fee", test.get(0), test1.get("Fee"));
-    assertEquals("Fie", test.get(1), test1.get("Fie"));
-    assertEquals("Foe", test.get(2), test1.get("Foe"));
+    try {
+      test1.get("Fee");
+      fail();
+    } catch (IndexException e) {
+      fail();
+    } catch (UnboundLabelException e) {
+      assertTrue(true);
+    }
 
   }
 
@@ -344,9 +349,14 @@
     Gson gson = builder.create();
     String json = gson.toJson(test, vectorType);
     Vector test1 = gson.fromJson(json, vectorType);
-    assertEquals("Fee", test.get(0), test1.get("Fee"));
-    assertEquals("Fie", test.get(1), test1.get("Fie"));
-    assertEquals("Foe", test.get(2), test1.get("Foe"));
+    try {
+      test1.get("Fee");
+      fail();
+    } catch (IndexException e) {
+      fail();
+    } catch (UnboundLabelException e) {
+      assertTrue(true);
+    }
   }
 
 }



Mime
View raw message