mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r928691 - in /lucene/mahout/trunk: collections/src/main/java/org/apache/mahout/math/buffer/ core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/ core/src/main/java/org/apache/mahout/df/ examples/src/main/java/org/apache/mahout/cf/...
Date Mon, 29 Mar 2010 10:35:00 GMT
Author: srowen
Date: Mon Mar 29 10:34:59 2010
New Revision: 928691

URL: http://svn.apache.org/viewvc?rev=928691&view=rev
Log:
Style stuff? some would say yes

Modified:
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/buffer/ObjectBuffer.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommender.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/IndexException.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizer.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparatorTest.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyTest.java

Modified: lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/buffer/ObjectBuffer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/buffer/ObjectBuffer.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/buffer/ObjectBuffer.java
(original)
+++ lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/buffer/ObjectBuffer.java
Mon Mar 29 10:34:59 2010
@@ -56,7 +56,7 @@ public class ObjectBuffer extends Persis
    * @param list the list of which all elements shall be added.
    */
   @Override
-  public void addAllOf(ObjectArrayList list) {
+  public void addAllOf(ObjectArrayList<Object> list) {
     int listSize = list.size();
     if (this.size + listSize >= this.capacity) {
       flush();

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
Mon Mar 29 10:34:59 2010
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.commons.lang.mutable.MutableInt;
 import org.apache.mahout.cf.taste.common.Refreshable;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.impl.common.FastByIDMap;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java Mon Mar
29 10:34:59 2010
@@ -168,6 +168,7 @@ public class DecisionForest implements W
     return trees.hashCode();
   }
 
+  @Override
   public void write(DataOutput dataOutput) throws IOException {
     dataOutput.writeInt(trees.size());
     for (Node tree:trees) {
@@ -180,6 +181,7 @@ public class DecisionForest implements W
    * @param dataInput
    * @throws IOException
    */
+  @Override
   public void readFields(DataInput dataInput) throws IOException {
     int size = dataInput.readInt();
     for (int i = 0; i < size; i++) {

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommender.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommender.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommender.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommender.java
Mon Mar 29 10:34:59 2010
@@ -23,7 +23,6 @@ import java.util.List;
 import org.apache.mahout.cf.taste.common.Refreshable;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.impl.neighborhood.NearestNUserNeighborhood;
-import org.apache.mahout.cf.taste.impl.recommender.CachingRecommender;
 import org.apache.mahout.cf.taste.impl.recommender.GenericUserBasedRecommender;
 import org.apache.mahout.cf.taste.impl.similarity.CachingUserSimilarity;
 import org.apache.mahout.cf.taste.impl.similarity.EuclideanDistanceSimilarity;

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/TestForest.java
Mon Mar 29 10:34:59 2010
@@ -42,14 +42,11 @@ import org.apache.mahout.common.CommandL
 import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.df.DFUtils;
 import org.apache.mahout.df.DecisionForest;
-import org.apache.mahout.df.ErrorEstimate;
-import org.apache.mahout.df.builder.DefaultTreeBuilder;
-import org.apache.mahout.df.callback.ForestPredictions;
-import org.apache.mahout.df.data.*;
-import org.apache.mahout.df.mapreduce.inmem.InMemBuilder;
-import org.apache.mahout.df.mapreduce.partial.PartialBuilder;
 import org.apache.mahout.classifier.ResultAnalyzer;
 import org.apache.mahout.classifier.ClassifierResult;
+import org.apache.mahout.df.data.DataConverter;
+import org.apache.mahout.df.data.Dataset;
+import org.apache.mahout.df.data.Instance;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/IndexException.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/IndexException.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/IndexException.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/IndexException.java Mon
Mar 29 10:34:59 2010
@@ -24,6 +24,6 @@ public class IndexException extends Runt
   }
 
   public IndexException(int index, int cardinality) {
-    super("index(" + index +") is out of bounds of (0, " + cardinality + ")");
+    super("index(" + index +") is out of bounds of (0, " + cardinality + ')');
   }
 }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java
(original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java
Mon Mar 29 10:34:59 2010
@@ -19,7 +19,6 @@ package org.apache.mahout.math.decompose
 
 
 import java.util.EnumMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
(original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
Mon Mar 29 10:34:59 2010
@@ -76,7 +76,7 @@ public abstract class SolverTest extends
       double afterNorm = afterMultiply.getLengthSquared();
       double error = 1 - dot / Math.sqrt(afterNorm * e.getLengthSquared());
       log.info("Eigenvalue({}) = {}", i, Math.sqrt(afterNorm/e.getLengthSquared()));
-      assertTrue("Error margin: {" + error + " too high! (for eigen " + i + ")", Math.abs(error)
< errorMargin);
+      assertTrue("Error margin: {" + error + " too high! (for eigen " + i + ')', Math.abs(error)
< errorMargin);
     }
   }
 

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
(original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
Mon Mar 29 10:34:59 2010
@@ -69,7 +69,7 @@ public class VectorHelper {
       bldr.append(elt.index()).append(':').append(dictionary != null ? dictionary[elt.index()]
: elt.get());
       
     }
-    return bldr.append("}").toString();
+    return bldr.append('}').toString();
   }
   
   /**

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizer.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizer.java
(original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizer.java
Mon Mar 29 10:34:59 2010
@@ -197,7 +197,7 @@ public final class DictionaryVectorizer 
     FileStatus[] outputFiles = fs.globStatus(new Path(wordCountPath.toString()
                                                       + OUTPUT_FILES_PATTERN));
     
-    long chunkSizeLimit = chunkSizeInMegabytes * 1024 * 1024;
+    long chunkSizeLimit = chunkSizeInMegabytes * 1024L * 1024L;
     int chunkIndex = 0;
     Path chunkPath = getPath(dictionaryPathBase + DICTIONARY_FILE,
       chunkIndex);

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java
(original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java
Mon Mar 29 10:34:59 2010
@@ -190,7 +190,7 @@ public final class TFIDFConverter {
     FileStatus[] outputFiles = fs.globStatus(new Path(featureCountPath.toString()
                                                       + OUTPUT_FILES_PATTERN));
     
-    long chunkSizeLimit = chunkSizeInMegabytes * 1024 * 1024;
+    long chunkSizeLimit = chunkSizeInMegabytes * 1024L * 1024L;
     int chunkIndex = 0;
     Path chunkPath = getPath(dictionaryPathBase + FREQUENCY_FILE, chunkIndex);
     chunkPaths.add(chunkPath);

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
(original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
Mon Mar 29 10:34:59 2010
@@ -64,9 +64,7 @@ public class CollocReducerTest {
                                     {new Gram("the worst", 1, NGRAM), new Gram("the", 2,
HEAD)},
                                     {new Gram("of times", 2, NGRAM), new Gram("of", 2, HEAD)},
                                     {new Gram("of times", 2, NGRAM), new Gram("times", 2,
TAIL)}};
-    
-    byte[] empty = new byte[0];
-    
+
     // set up expectations
     for (Gram[] v : values) {
       output.collect(v[0], v[1]);
@@ -77,7 +75,8 @@ public class CollocReducerTest {
     CollocReducer c = new CollocReducer();
     
     GramKey key = new GramKey();
-    
+
+    byte[] empty = new byte[0];
     for (Gram[] ii : input) {
       key.set(ii[0], empty);
 

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparatorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparatorTest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparatorTest.java
(original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparatorTest.java
Mon Mar 29 10:34:59 2010
@@ -21,14 +21,14 @@ import junit.framework.Assert;
 
 import org.junit.Test;
 
-
 public class GramKeyGroupComparatorTest {
+
   @Test
   public void testComparator() {
-    byte[] empty = new byte[0];
     byte[] foo   = new byte[1];
     foo[0] = (byte) 1;
-    
+
+    byte[] empty = new byte[0];
     GramKey a = new GramKey(new Gram("foo", 1, Gram.Type.HEAD), empty); // base
     GramKey b = new GramKey(new Gram("foo", 1, Gram.Type.HEAD), foo);   // vary byte
     GramKey c = new GramKey(new Gram("foo", 2, Gram.Type.HEAD), empty); // vary freq
@@ -36,9 +36,9 @@ public class GramKeyGroupComparatorTest 
     GramKey e = new GramKey(new Gram("bar", 5, Gram.Type.HEAD), empty); // vary string
     
     GramKeyGroupComparator cmp = new GramKeyGroupComparator();
-    
-    Assert.assertTrue(0 == cmp.compare(a, b));
-    Assert.assertTrue(0 == cmp.compare(a, c));
+
+    Assert.assertEquals(0, cmp.compare(a, b));
+    Assert.assertEquals(0, cmp.compare(a, c));
     Assert.assertTrue(0 > cmp.compare(a, d));
     Assert.assertTrue(0 < cmp.compare(a, e));
     Assert.assertTrue(0 < cmp.compare(d, e));

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java
(original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java
Mon Mar 29 10:34:59 2010
@@ -25,15 +25,15 @@ import org.junit.Test;
 public class GramKeyPartitionerTest {
   @Test
   public void testPartition() {
-    byte[] empty = new byte[0];
     byte[] foo = new byte[1];
     foo[0] = 1;
-    
-    byte[] bar = new byte[1];
+
     foo[0] = 2;
-    
+
+    byte[] empty = new byte[0];
     GramKey a = new GramKey(new Gram("foo", 1, Gram.Type.HEAD), empty);
     GramKey b = new GramKey(new Gram("foo", 1, Gram.Type.HEAD), foo);
+    byte[] bar = new byte[1];
     GramKey c = new GramKey(new Gram("foo", 2, Gram.Type.HEAD), bar);
     GramKey d = new GramKey(new Gram("foo", 1, Gram.Type.TAIL), empty);
     GramKey e = new GramKey(new Gram("foo", 2, Gram.Type.TAIL), foo);

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyTest.java?rev=928691&r1=928690&r2=928691&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyTest.java
(original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyTest.java
Mon Mar 29 10:34:59 2010
@@ -25,20 +25,18 @@ import java.io.IOException;
 import java.util.Arrays;
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
 import org.junit.Test;
 
-
 public class GramKeyTest {
   @Test
   public void testGramKeySort() {
-    byte[] empty = new byte[0];
-    byte[] foo = new byte[1]; foo[0] = 1;
-    byte[] bar = new byte[1]; bar[0] = 2;
+    byte[] foo = {1};
+    //byte[] bar = new byte[1]; bar[0] = 2;
     
     
     // byte argument in GramKey breaks tie between equal grams
+    byte[] empty = new byte[0];
     GramKey[] input =
     {
       new GramKey(new Gram("bar", 1, Gram.Type.UNIGRAM), empty),
@@ -65,15 +63,15 @@ public class GramKeyTest {
     Arrays.sort(sorted);
 
     for (int i=0; i < input.length; i++) {
-      TestCase.assertSame(input[expect[i]], sorted[i]);
+      Assert.assertSame(input[expect[i]], sorted[i]);
     }
   }
   
   @Test
   public void testWritable() throws IOException {
     byte[] foo = new byte[0];
-    byte[] bar = new byte[1]; bar[0] = 2;
-    
+    byte[] bar = {2};
+
     GramKey one = new GramKey(new Gram("foo", 2, Gram.Type.HEAD), foo);
     GramKey two = new GramKey(new Gram("foobar", 3, Gram.Type.UNIGRAM), bar);
 
@@ -86,6 +84,7 @@ public class GramKeyTest {
     DataOutputStream out = new DataOutputStream(bout);
     
     two.write(out);
+    out.close();
     
     byte[] b = bout.toByteArray();
     
@@ -93,6 +92,7 @@ public class GramKeyTest {
     DataInputStream din = new DataInputStream(bin);
     
     one.readFields(din);
+    din.close();
 
     Assert.assertTrue(Arrays.equals(two.getBytes(), one.getBytes()));
     Assert.assertEquals(Gram.Type.UNIGRAM, one.getType());



Mime
View raw message