mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwe...@apache.org
Subject svn commit: r635219 - in /lucene/mahout/trunk/src: main/java/org/apache/mahout/utils/Point.java test/java/org/apache/mahout/utils/TestPoint.java
Date Sun, 09 Mar 2008 11:42:17 GMT
Author: dweiss
Date: Sun Mar  9 04:42:16 2008
New Revision: 635219

URL: http://svn.apache.org/viewvc?rev=635219&view=rev
Log:
Off by one corrected.
https://issues.apache.org/jira/browse/MAHOUT-12

Modified:
    lucene/mahout/trunk/src/main/java/org/apache/mahout/utils/Point.java
    lucene/mahout/trunk/src/test/java/org/apache/mahout/utils/TestPoint.java

Modified: lucene/mahout/trunk/src/main/java/org/apache/mahout/utils/Point.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/src/main/java/org/apache/mahout/utils/Point.java?rev=635219&r1=635218&r2=635219&view=diff
==============================================================================
--- lucene/mahout/trunk/src/main/java/org/apache/mahout/utils/Point.java (original)
+++ lucene/mahout/trunk/src/main/java/org/apache/mahout/utils/Point.java Sun Mar  9 04:42:16
2008
@@ -61,7 +61,7 @@
       || formattedString.charAt(formattedString.length() - 1) != ']') {
       throw new IllegalArgumentException(formattedString);
     }
-    formattedString = formattedString.substring(1, formattedString.length() - 2);
+    formattedString = formattedString.substring(1, formattedString.length() - 1);
 
     final String[] pts = splitPattern.split(formattedString);
     final Float[] point = new Float[pts.length];

Modified: lucene/mahout/trunk/src/test/java/org/apache/mahout/utils/TestPoint.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/src/test/java/org/apache/mahout/utils/TestPoint.java?rev=635219&r1=635218&r2=635219&view=diff
==============================================================================
--- lucene/mahout/trunk/src/test/java/org/apache/mahout/utils/TestPoint.java (original)
+++ lucene/mahout/trunk/src/test/java/org/apache/mahout/utils/TestPoint.java Sun Mar  9 04:42:16
2008
@@ -1,5 +1,7 @@
 package org.apache.mahout.utils;
 
+import java.util.Arrays;
+
 import junit.framework.TestCase;
 
 /**
@@ -26,5 +28,11 @@
   
   public void testPtOut() {
     assertEquals("abc[1.0, 1.5]", Point.ptOut("abc", new Float [] {1.0f, 1.5f}));
+  }
+  
+  public void testDecodePoint() {
+    assertEquals(
+        Arrays.asList(new Float [] {1.0f, 2.5f}), 
+        Arrays.asList(Point.decodePoint("[1.0, 2.5]")));
   }
 }



Mime
View raw message