mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r935541 - in /lucene/mahout/trunk: collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/ collections/src/test/java/org/apache/mahout/math/map/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/ core/src/main/java...
Date Mon, 19 Apr 2010 12:24:56 GMT
Author: srowen
Date: Mon Apr 19 12:24:54 2010
New Revision: 935541

URL: http://svn.apache.org/viewvc?rev=935541&view=rev
Log:
Small style bits - mostly braces around conditionals which I think is our convention now

Modified:
    lucene/mahout/trunk/collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/CodeGenerator.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/RecommendedItemsWritable.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/ItemSimilarityJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/Cluster.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/ClusterBase.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletCluster.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/AsymmetricSampledNormalModel.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/DecisionForest.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/Classifier.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/bayes/BayesClassifierSelfTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDirichletClustering.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataLoaderTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/inmem/InMemInputFormatTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/canopy/DisplayCanopy.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/meanshift/DisplayMeanShift.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosToolTest.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/MockDataSet.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/RandomRuleResults.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianSolver.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianUpdater.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/lanczos/LanczosSolver.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory2D.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SingularValueDecomposition.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/hebbian/TestHebbianSolver.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/lanczos/TestLanczosSolver.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/Gram.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKey.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java

Modified: lucene/mahout/trunk/collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/CodeGenerator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/CodeGenerator.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/CodeGenerator.java (original)
+++ lucene/mahout/trunk/collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/CodeGenerator.java Mon Apr 19 12:24:54 2010
@@ -27,6 +27,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Pattern;
 
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -38,6 +39,7 @@ import org.apache.velocity.VelocityConte
 import org.apache.velocity.app.VelocityEngine;
 import org.apache.velocity.context.Context;
 import org.codehaus.plexus.util.SelectorUtils;
+
 /**
  * @description Generate java code with Velocity.
  * @goal generate
@@ -47,7 +49,9 @@ import org.codehaus.plexus.util.Selector
 public class CodeGenerator extends AbstractMojo {
   
   private static final String[] NO_STRINGS = {null};
-  private static final Charset UTF8 = Charset.forName("utf-8");
+  private static final Charset UTF8 = Charset.forName("UTF-8");
+  private static final Pattern COMMA_PATTERN = Pattern.compile(",");
+
   private final Map<String,String> typeToObjectTypeMap;
   
   /**
@@ -129,7 +133,7 @@ public class CodeGenerator extends Abstr
   private VelocityEngine testVelocityEngine;
   private final FileSetManager fileSetManager;
   private VelocityEngine mainVelocityEngine;
-  
+
   public CodeGenerator() {
     typeToObjectTypeMap = new HashMap<String,String>();
     typeToObjectTypeMap.put("boolean", "Boolean");
@@ -228,13 +232,13 @@ public class CodeGenerator extends Abstr
     boolean hasValue = template.contains("ValueType");
     String[] keys;
     if (hasKey) {
-      keys = keyTypes.split(",");
+      keys = COMMA_PATTERN.split(keyTypes);
     } else {
       keys = NO_STRINGS;
     }
     String[] values;
     if (hasValue) {
-      values = valueTypes.split(",");
+      values = COMMA_PATTERN.split(valueTypes);
     } else {
       values = NO_STRINGS;
     }

Modified: lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java (original)
+++ lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java Mon Apr 19 12:24:54 2010
@@ -179,7 +179,7 @@ public class OpenHashMapTest extends Ass
     
     pairs.clear();
     map.forEachPair(new ObjectObjectProcedure<String, String>() {
-      int count = 0;
+      private int count = 0;
       
       @Override
       public boolean apply(String first, String second) {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/RecommendedItemsWritable.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/RecommendedItemsWritable.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/RecommendedItemsWritable.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/RecommendedItemsWritable.java Mon Apr 19 12:24:54 2010
@@ -19,7 +19,6 @@ package org.apache.mahout.cf.taste.hadoo
 
 import java.io.DataInput;
 import java.io.DataOutput;
-import java.io.EOFException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/ItemSimilarityJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/ItemSimilarityJob.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/ItemSimilarityJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/ItemSimilarityJob.java Mon Apr 19 12:24:54 2010
@@ -19,7 +19,6 @@ package org.apache.mahout.cf.taste.hadoo
 
 import java.util.Map;
 
-import org.apache.commons.cli2.Option;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.DoubleWritable;
 import org.apache.hadoop.io.FloatWritable;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/Cluster.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/Cluster.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/Cluster.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/Cluster.java Mon Apr 19 12:24:54 2010
@@ -29,20 +29,20 @@ public interface Cluster {
    * 
    * @return a unique integer
    */
-  public int getId();
+  int getId();
 
   /**
    * Get the "center" of the Cluster as a Vector
    * 
    * @return a Vector
    */
-  public Vector getCenter();
+  Vector getCenter();
 
   /**
    * Get an integer denoting the number of points observed by this cluster
    * @return an integer 
    */
-  public int getNumPoints();
+  int getNumPoints();
 
   /**
    * Produce a custom, human-friendly, printable representation of the Cluster.

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/ClusterBase.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/ClusterBase.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/ClusterBase.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/ClusterBase.java Mon Apr 19 12:24:54 2010
@@ -40,18 +40,20 @@ import com.google.gson.reflect.TypeToken
  *
  */
 public abstract class ClusterBase implements Writable, Cluster {
+
   // this cluster's clusterId
-  int id;
+  private int id;
   
   // the current cluster center
-  Vector center = new RandomAccessSparseVector(0);
+  private Vector center = new RandomAccessSparseVector(0);
   
   // the number of points in the cluster
-  int numPoints;
+  private int numPoints;
   
   // the Vector total of all points added to the cluster
   private Vector pointTotal;
   
+  @Override
   public int getId() {
     return id;
   }
@@ -60,6 +62,7 @@ public abstract class ClusterBase implem
     this.id = id;
   }
   
+  @Override
   public Vector getCenter() {
     return center;
   }
@@ -68,6 +71,7 @@ public abstract class ClusterBase implem
     this.center = center;
   }
   
+  @Override
   public int getNumPoints() {
     return numPoints;
   }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletCluster.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletCluster.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletCluster.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletCluster.java Mon Apr 19 12:24:54 2010
@@ -115,14 +115,17 @@ public class DirichletCluster<O> impleme
     return gson.toJson(this, clusterType);
   }
 
+  @Override
   public int getId() {
     return model.getId();
   }
 
+  @Override
   public Vector getCenter() {
     return model.getCenter();
   }
 
+  @Override
   public int getNumPoints() {
     return model.getNumPoints();
   }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java Mon Apr 19 12:24:54 2010
@@ -117,9 +117,13 @@ public class DirichletDriver {
       String input = cmdLine.getValue(inputOpt).toString();
       String output = cmdLine.getValue(outputOpt).toString();
       String modelFactory = "org.apache.mahout.clustering.dirichlet.models.NormalModelDistribution";
-      if (cmdLine.hasOption(modelOpt)) modelFactory = cmdLine.getValue(modelOpt).toString();
+      if (cmdLine.hasOption(modelOpt)) {
+        modelFactory = cmdLine.getValue(modelOpt).toString();
+      }
       String modelPrototype = "org.apache.mahout.math.RandomAccessSparseVector";
-      if (cmdLine.hasOption(prototypeOpt)) modelPrototype = cmdLine.getValue(prototypeOpt).toString();
+      if (cmdLine.hasOption(prototypeOpt)) {
+        modelPrototype = cmdLine.getValue(prototypeOpt).toString();
+      }
       int prototypeSize = Integer.parseInt(cmdLine.getValue(sizeOpt).toString());
       int numReducers = Integer.parseInt(cmdLine.getValue(numRedOpt).toString());
       int numModels = Integer.parseInt(cmdLine.getValue(topicsOpt).toString());

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java Mon Apr 19 12:24:54 2010
@@ -90,9 +90,13 @@ public final class DirichletJob {
       String input = cmdLine.getValue(inputOpt).toString();
       String output = cmdLine.getValue(outputOpt).toString();
       String modelFactory = "org.apache.mahout.clustering.dirichlet.models.NormalModelDistribution";
-      if (cmdLine.hasOption(modelOpt)) modelFactory = cmdLine.getValue(modelOpt).toString();
+      if (cmdLine.hasOption(modelOpt)) {
+        modelFactory = cmdLine.getValue(modelOpt).toString();
+      }
       String modelPrototype = "org.apache.mahout.math.RandomAccessSparseVector";
-      if (cmdLine.hasOption(prototypeOpt)) modelPrototype = cmdLine.getValue(prototypeOpt).toString();
+      if (cmdLine.hasOption(prototypeOpt)) {
+        modelPrototype = cmdLine.getValue(prototypeOpt).toString();
+      }
       int prototypeSize = Integer.parseInt(cmdLine.getValue(sizeOpt).toString());
       int numModels = Integer.parseInt(cmdLine.getValue(topicsOpt).toString());
       int maxIterations = Integer.parseInt(cmdLine.getValue(maxIterOpt).toString());

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/AsymmetricSampledNormalModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/AsymmetricSampledNormalModel.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/AsymmetricSampledNormalModel.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/AsymmetricSampledNormalModel.java Mon Apr 19 12:24:54 2010
@@ -149,6 +149,7 @@ public class AsymmetricSampledNormalMode
     return asFormatString(null);
   }
   
+  @Override
   public String asFormatString(String[] bindings) {
     StringBuilder buf = new StringBuilder(50);
     buf.append("asnm{n=").append(s0).append(" m=");
@@ -186,6 +187,7 @@ public class AsymmetricSampledNormalMode
     VectorWritable.writeVector(out, s2);
   }
   
+  @Override
   public String asJsonString() {
     GsonBuilder builder = new GsonBuilder();
     builder.registerTypeAdapter(Model.class, new JsonModelAdapter());

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java Mon Apr 19 12:24:54 2010
@@ -241,7 +241,9 @@ public class Cluster extends ClusterBase
   
   /** @return the std */
   public double getStd() {
-    if (getNumPoints() == 0) return std;
+    if (getNumPoints() == 0) {
+      return std;
+    }
     Vector stds = pointSquaredTotal.times(getNumPoints()).minus(getPointTotal().times(getPointTotal()))
         .assign(new SquareRootFunction()).divide(getNumPoints());
     return stds.zSum() / stds.size();

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java Mon Apr 19 12:24:54 2010
@@ -149,10 +149,11 @@ public class MeanShiftCanopyJob {
     fs.mkdirs(outPath);
   
     String clustersIn = output + "/initial-canopies";
-    if (inputIsCanopies)
+    if (inputIsCanopies) {
       clustersIn = input;
-    else
+    } else {
       MeanShiftCanopyDriver.createCanopyFromVectors(input, clustersIn);
+    }
   
     // iterate until the clusters converge
     boolean converged = false;

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=935541&r1=935540&r2=935541&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 Apr 19 12:24:54 2010
@@ -210,16 +210,17 @@ public class DecisionForest implements W
     FileSystem fs = forestPath.getFileSystem(conf);
     Path[] files = null;
 
-    if (fs.getFileStatus(forestPath).isDir())
+    if (fs.getFileStatus(forestPath).isDir()) {
       files = DFUtils.listOutputFiles(fs, forestPath);
-    else
-      files = new Path[] {forestPath};
+    } else {
+      files = new Path[]{forestPath};
+    }
 
     DecisionForest forest = null;
     for (Path path : files) {
       FSDataInputStream dataInput = new FSDataInputStream(fs.open(path));
       if (forest == null) {
-        forest = DecisionForest.read(dataInput);
+        forest = read(dataInput);
       } else {
         forest.readFields(dataInput);
       }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/Classifier.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/Classifier.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/Classifier.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/Classifier.java Mon Apr 19 12:24:54 2010
@@ -169,11 +169,6 @@ public class Classifier {
    * mapper.
    */
   public static class CTextInputFormat extends TextInputFormat {
-
-    public CTextInputFormat() {
-      super();
-    }
-    
     @Override
     protected boolean isSplitable(JobContext jobContext, Path path) {
       return false;
@@ -187,11 +182,11 @@ public class Classifier {
 
     private DecisionForest forest;
 
-    private Random rng = RandomUtils.getRandom();
+    private final Random rng = RandomUtils.getRandom();
 
     private boolean first = true;
 
-    private Text lvalue = new Text();
+    private final Text lvalue = new Text();
 
 
     @Override
@@ -228,12 +223,12 @@ public class Classifier {
       }
 
       String line = value.toString();
-      if (line.isEmpty()) return;
-
-      Instance instance = converter.convert(0, line);
-      int prediction = forest.classify(rng, instance);
-      lvalue.set(Integer.toString(prediction));
-      context.write(key, lvalue);
+      if (!line.isEmpty()) {
+        Instance instance = converter.convert(0, line);
+        int prediction = forest.classify(rng, instance);
+        lvalue.set(Integer.toString(prediction));
+        context.write(key, lvalue);
+      }
     }
   }
 }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/bayes/BayesClassifierSelfTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/bayes/BayesClassifierSelfTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/bayes/BayesClassifierSelfTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/bayes/BayesClassifierSelfTest.java Mon Apr 19 12:24:54 2010
@@ -79,10 +79,7 @@ public class BayesClassifierSelfTest ext
     int[][] matrix = resultAnalyzer.getConfusionMatrix().getConfusionMatrix();
     for (int i = 0; i < 3; i++) {
       for (int j = 0; j < 3; j++) {
-        if (i == j)
-          assertEquals(4, matrix[i][j]);
-        else
-          assertEquals(0, matrix[i][j]);
+        assertEquals(i == j ? 4 : 0, matrix[i][j]);
       }
     }
     params.set("testDirPath", "testdata/bayesinput");
@@ -93,10 +90,7 @@ public class BayesClassifierSelfTest ext
     matrix = BayesClassifierDriver.readResult(fs, outputFiles, conf, params).getConfusionMatrix();
     for (int i = 0; i < 3; i++) {
       for (int j = 0; j < 3; j++) {
-        if (i == j)
-          assertEquals(4, matrix[i][j]);
-        else
-          assertEquals(0, matrix[i][j]);
+        assertEquals(i == j ? 4 : 0, matrix[i][j]);
       }
     }
   }
@@ -133,10 +127,7 @@ public class BayesClassifierSelfTest ext
     int[][] matrix = resultAnalyzer.getConfusionMatrix().getConfusionMatrix();
     for (int i = 0; i < 3; i++) {
       for (int j = 0; j < 3; j++) {
-        if (i == j)
-          assertEquals(4, matrix[i][j]);
-        else
-          assertEquals(0, matrix[i][j]);
+        assertEquals(i == j ? 4 : 0, matrix[i][j]);
       }
     }
     params.set("testDirPath", "testdata/bayesinput");
@@ -147,10 +138,7 @@ public class BayesClassifierSelfTest ext
     matrix = BayesClassifierDriver.readResult(fs, outputFiles, conf, params).getConfusionMatrix();
     for (int i = 0; i < 3; i++) {
       for (int j = 0; j < 3; j++) {
-        if (i == j)
-          assertEquals(4, matrix[i][j]);
-        else
-          assertEquals(0, matrix[i][j]);
+        assertEquals(i == j ? 4 : 0, matrix[i][j]);
       }
     }
   }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java Mon Apr 19 12:24:54 2010
@@ -27,7 +27,6 @@ import org.apache.mahout.clustering.diri
 import org.apache.mahout.clustering.dirichlet.models.Model;
 import org.apache.mahout.clustering.dirichlet.models.NormalModel;
 import org.apache.mahout.clustering.dirichlet.models.SampledNormalModel;
-import org.apache.mahout.clustering.Cluster;
 import org.apache.mahout.clustering.meanshift.MeanShiftCanopy;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.math.DenseVector;

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDirichletClustering.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDirichletClustering.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDirichletClustering.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDirichletClustering.java Mon Apr 19 12:24:54 2010
@@ -53,8 +53,9 @@ public class TestDirichletClustering ext
         + "] sd=" + sd);
     for (int i = 0; i < num; i++) {
       DenseVector v = new DenseVector(card);
-      for (int j = 0; j < card; j++)
+      for (int j = 0; j < card; j++) {
         v.set(j, UncommonDistributions.rNorm(mx, sd));
+      }
       sampleData.add(new VectorWritable(v));
     }
   }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java Mon Apr 19 12:24:54 2010
@@ -303,8 +303,9 @@ public class TestMeanShift extends Mahou
     }
     FileSystem fs = FileSystem.get(new Path("testdata").toUri(), conf);
     List<VectorWritable> points = new ArrayList<VectorWritable>();
-    for (Vector v : raw)
+    for (Vector v : raw) {
       points.add(new VectorWritable(v));
+    }
     ClusteringTestUtils.writePointsToFile(points, "testdata/file1", fs, conf);
     ClusteringTestUtils.writePointsToFile(points, "testdata/file2", fs, conf);
     // now run the Job

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataLoaderTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataLoaderTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataLoaderTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataLoaderTest.java Mon Apr 19 12:24:54 2010
@@ -142,8 +142,9 @@ public class DataLoaderTest extends Maho
     // make sure that the attributes are loaded correctly
     int lind = 0;
     for (int index = 0; index < data.length; index++) {
-      if (missings.contains(index))
-        continue; // this vector won't be loaded
+      if (missings.contains(index)) {
+        continue;
+      }// this vector won't be loaded
 
       double[] vector = data[index];
       Instance instance = loaded.get(lind);
@@ -153,8 +154,9 @@ public class DataLoaderTest extends Maho
 
       int aId = 0;
       for (int attr = 0; attr < nbAttributes; attr++) {
-        if (attrs[attr].isIgnored())
+        if (attrs[attr].isIgnored()) {
           continue;
+        }
 
         if (attrs[attr].isNumerical()) {
           assertEquals(vector[attr], instance.get(aId++));
@@ -193,8 +195,9 @@ public class DataLoaderTest extends Maho
 
       int aId = 0;
       for (int attr = 0; attr < nbAttributes; attr++) {
-        if (attrs[attr].isIgnored() || attrs[attr].isLabel())
+        if (attrs[attr].isIgnored() || attrs[attr].isLabel()) {
           continue;
+        }
 
         assertEquals(attrs[attr].isNumerical(), loaded.getDataset().isNumerical(aId));
         
@@ -273,8 +276,9 @@ public class DataLoaderTest extends Maho
     int lind = 0;
 
     for (int index = 0; index < source.length; index++) {
-      if (missings.contains(index))
+      if (missings.contains(index)) {
         continue;
+      }
 
       if (source[index][attr] == oValue) {
         assertEquals(nValue, loaded.get(lind).get(aId));
@@ -303,8 +307,9 @@ public class DataLoaderTest extends Maho
     int lind = 0;
 
     for (int index = 0; index < source.length; index++) {
-      if (missings.contains(index))
+      if (missings.contains(index)) {
         continue;
+      }
 
       if (source[index][labelInd] == value) {
         assertEquals(code, loaded.get(lind).label);

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java Mon Apr 19 12:24:54 2010
@@ -97,8 +97,9 @@ public class DataTest extends MahoutTest
   private static int count(double[] values, double value) {
     int count = 0;
     for (double v : values) {
-      if (v == value)
+      if (v == value) {
         count++;
+      }
     }
     return count;
   }
@@ -302,10 +303,12 @@ public class DataTest extends MahoutTest
     boolean found2 = false;
     for (int index = 0; index < 10 && (!found1 || !found2); index++) {
       int major = data.majorityLabel(rng);
-      if (major == code1)
+      if (major == code1) {
         found1 = true;
-      if (major == code2)
+      }
+      if (major == code2) {
         found2 = true;
+      }
     }
     assertTrue(found1 && found2);
   }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java Mon Apr 19 12:24:54 2010
@@ -79,12 +79,13 @@ public final class Utils {
 
     for (int token = 0; token < nbTokens; token++) {
       double rand = rng.nextDouble();
-      if (rand < 0.1)
+      if (rand < 0.1) {
         result[token] = 'I'; // IGNORED
-      else if (rand < 0.5)
+      } else if (rand >= 0.5) {
+        result[token] = 'C';
+      } else {
         result[token] = 'N'; // NUMERICAL
-      else
-        result[token] = 'C'; // CATEGORICAL
+      } // CATEGORICAL
     }
 
     // choose the label
@@ -201,13 +202,14 @@ public final class Utils {
     double[] vector = new double[attrs.length];
 
     for (int attr = 0; attr < attrs.length; attr++) {
-      if (attrs[attr].isIgnored())
+      if (attrs[attr].isIgnored()) {
         vector[attr] = Double.NaN;
-      else if (attrs[attr].isNumerical())
+      } else if (attrs[attr].isNumerical()) {
         vector[attr] = rng.nextDouble();
-      else
+      } else {
         // CATEGORICAL or LABEL
         vector[attr] = rng.nextInt(CATEGORICAL_RANGE);
+      }
     }
 
     return vector;
@@ -298,8 +300,9 @@ public final class Utils {
   public static Path writeDataToTestFile(String[] sData) throws IOException {
     Path testData = new Path("testdata/Data");
     FileSystem fs = testData.getFileSystem(new Configuration());
-    if (!fs.exists(testData))
+    if (!fs.exists(testData)) {
       fs.mkdirs(testData);
+    }
   
     Path path = new Path(testData, "DataLoaderTest.data");
   
@@ -311,8 +314,9 @@ public final class Utils {
   public static Path writeDatasetToTestFile(Dataset dataset) throws IOException {
     Path testData = new Path("testdata/Dataset");
     FileSystem fs = testData.getFileSystem(new Configuration());
-    if (!fs.exists(testData))
+    if (!fs.exists(testData)) {
       fs.mkdirs(testData);
+    }
   
     Path datasetPath = new Path(testData, "dataset.info");
     FSDataOutputStream out = fs.create(datasetPath);

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/inmem/InMemInputFormatTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/inmem/InMemInputFormatTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/inmem/InMemInputFormatTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/inmem/InMemInputFormatTest.java Mon Apr 19 12:24:54 2010
@@ -62,10 +62,11 @@ public class InMemInputFormatTest extend
 
         assertEquals(expectedId, split.getFirstId());
 
-        if (index < numSplits - 1)
+        if (index < numSplits - 1) {
           assertEquals(nbTreesPerSplit, split.getNbTrees());
-        else
+        } else {
           assertEquals(nbTrees - totalTrees, split.getNbTrees());
+        }
 
         totalTrees += split.getNbTrees();
         expectedId += split.getNbTrees();

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java Mon Apr 19 12:24:54 2010
@@ -63,8 +63,9 @@ public class PartialBuilderTest extends 
     // store the output in a sequence file
     Path base = new Path("testdata");
     FileSystem fs = base.getFileSystem(job);
-    if (fs.exists(base))
+    if (fs.exists(base)) {
       fs.delete(base, true);
+    }
 
     Path outputFile = new Path(base, "PartialBuilderTest.seq");
     Writer writer = SequenceFile.createWriter(fs, job, outputFile,

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/canopy/DisplayCanopy.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/canopy/DisplayCanopy.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/canopy/DisplayCanopy.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/canopy/DisplayCanopy.java Mon Apr 19 12:24:54 2010
@@ -67,8 +67,9 @@ class DisplayCanopy extends DisplayDiric
     RandomUtils.useTestSeed();
     DisplayDirichlet.generateSamples();
     List<Vector> points = new ArrayList<Vector>();
-    for (VectorWritable sample : sampleData)
+    for (VectorWritable sample : sampleData) {
       points.add(sample.get());
+    }
     canopies = CanopyClusterer.createCanopies(points, new ManhattanDistanceMeasure(), t1, t2);
     CanopyClusterer.updateCentroids(canopies);
     new DisplayCanopy();

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/meanshift/DisplayMeanShift.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/meanshift/DisplayMeanShift.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/meanshift/DisplayMeanShift.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/meanshift/DisplayMeanShift.java Mon Apr 19 12:24:54 2010
@@ -87,8 +87,9 @@ class DisplayMeanShift extends DisplayDi
     RandomUtils.useTestSeed();
     DisplayDirichlet.generateSamples();
     List<Vector> points = new ArrayList<Vector>();
-    for (VectorWritable sample : sampleData)
+    for (VectorWritable sample : sampleData) {
       points.add(sample.get());
+    }
     canopies = MeanShiftCanopyClusterer.clusterPoints(points, new EuclideanDistanceMeasure(), 0.5, 1.0, 0.05,
       10);
     for (MeanShiftCanopy canopy : canopies) {

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java Mon Apr 19 12:24:54 2010
@@ -134,15 +134,15 @@ public class CDGA {
       
       String dataset = cmdLine.getValue(inputOpt).toString();
       int target = Integer.parseInt(cmdLine.getValue(labelOpt).toString());
-      double threshold = !cmdLine.hasOption(thresholdOpt) ? 0.5 : Double.parseDouble(cmdLine.getValue(
-        thresholdOpt).toString());
-      int crosspnts = !cmdLine.hasOption(crosspntsOpt) ? 1 : Integer.parseInt(cmdLine.getValue(crosspntsOpt)
-          .toString());
+      double threshold = cmdLine.hasOption(thresholdOpt) ?
+          Double.parseDouble(cmdLine.getValue(thresholdOpt).toString()) : 0.5;
+      int crosspnts = cmdLine.hasOption(crosspntsOpt) ?
+          Integer.parseInt(cmdLine.getValue(crosspntsOpt).toString()) : 1;
       double mutrate = Double.parseDouble(cmdLine.getValue(mutrateOpt).toString());
-      double mutrange = !cmdLine.hasOption(mutrangeOpt) ? 0.1 : Double.parseDouble(cmdLine.getValue(
-        mutrangeOpt).toString());
-      int mutprec = !cmdLine.hasOption(mutprecOpt) ? 2 : Integer.parseInt(cmdLine.getValue(mutprecOpt)
-          .toString());
+      double mutrange = cmdLine.hasOption(mutrangeOpt) ?
+          Double.parseDouble(cmdLine.getValue(mutrangeOpt).toString()) : 0.1;
+      int mutprec = cmdLine.hasOption(mutprecOpt) ?
+          Integer.parseInt(cmdLine.getValue(mutprecOpt).toString()) : 2;
       int popSize = Integer.parseInt(cmdLine.getValue(popsizeOpt).toString());
       int genCount = Integer.parseInt(cmdLine.getValue(gencntOpt).toString());
       

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java (original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java Mon Apr 19 12:24:54 2010
@@ -100,10 +100,7 @@ public class CDRuleTest extends MahoutTe
 
       // all coditions should return false unless w < threshold
       for (int condInd = 0; condInd < rule.getNbConditions(); condInd++) {
-        if (rule.getW(condInd) < thr)
-          assertTrue(rule.condition(condInd, dl));
-        else
-          assertFalse(rule.condition(condInd, dl));
+        assertEquals(rule.getW(condInd) < thr, rule.condition(condInd, dl));
       }
 
       mock.verify();
@@ -136,10 +133,7 @@ public class CDRuleTest extends MahoutTe
 
       // the condition is true if the operator is >=
       for (int condInd = 0; condInd < rule.getNbConditions(); condInd++) {
-        if (rule.getO(condInd))
-          assertTrue(rule.condition(condInd, dl));
-        else
-          assertFalse(rule.condition(condInd, dl));
+        assertEquals(rule.getO(condInd), rule.condition(condInd, dl));
       }
 
       mock.verify();
@@ -175,11 +169,8 @@ public class CDRuleTest extends MahoutTe
       // (value==1), or the operator is != and the values are no equal
       // (value==0)
       for (int condInd = 0; condInd < rule.getNbConditions(); condInd++) {
-        if ((rule.getO(condInd) && rule.getV(condInd) == 1)
-            || (!rule.getO(condInd) && rule.getV(condInd) != 1))
-          assertTrue(rule.condition(condInd, dl));
-        else
-          assertFalse(rule.condition(condInd, dl));
+        assertEquals(!(rule.getO(condInd) ^ rule.getV(condInd) == 1.0),
+                     rule.condition(condInd, dl));
       }
 
       mock.verify();

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosToolTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosToolTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosToolTest.java (original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosToolTest.java Mon Apr 19 12:24:54 2010
@@ -185,8 +185,9 @@ public class CDInfosToolTest extends Mah
   private static int nbNonIgnored(Descriptors descriptors) {
     int nbattrs = 0;
     for (int index = 0; index < descriptors.size(); index++) {
-      if (!descriptors.isIgnored(index))
+      if (!descriptors.isIgnored(index)) {
         nbattrs++;
+      }
     }
     
     return nbattrs;

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/MockDataSet.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/MockDataSet.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/MockDataSet.java (original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/MockDataSet.java Mon Apr 19 12:24:54 2010
@@ -73,10 +73,11 @@ public class MockDataSet {
       if (index == labelpos) {
         // two-classes
         prepareCategoricalAttribute(index, 2);
-      } else if (rng.nextDouble() < numRate)
+      } else if (rng.nextDouble() < numRate) {
         prepareNumericalAttribute(index);
-      else
+      } else {
         prepareCategoricalAttribute(index, rng.nextInt(100) + 1);
+      }
     }
 
     EasyMock.replay(dataset);

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/RandomRuleResults.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/RandomRuleResults.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/RandomRuleResults.java (original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/utils/RandomRuleResults.java Mon Apr 19 12:24:54 2010
@@ -31,10 +31,11 @@ public final class RandomRuleResults {
 
   public static synchronized void addResult(int ruleid, CDFitness fit) {
     CDFitness f = results.get(ruleid);
-    if (f == null)
+    if (f == null) {
       f = new CDFitness(fit);
-    else
+    } else {
       f.add(fit);
+    }
     
     results.put(ruleid, f);
   }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java Mon Apr 19 12:24:54 2010
@@ -46,7 +46,9 @@ public class AsyncEigenVerifier extends 
         threadPool.execute(new VerifierRunnable(corpus, vectorCopy));
         started = true;
       }
-      if (finished) finished = false;
+      if (finished) {
+        finished = false;
+      }
       return status;
     }
   }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianSolver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianSolver.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianSolver.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianSolver.java Mon Apr 19 12:24:54 2010
@@ -182,8 +182,9 @@ public class HebbianSolver {
         updater.update(currentEigen, initialTrainingVector, state);
         for (int corpusRow = 0; corpusRow < corpus.numRows(); corpusRow++) {
           state.setTrainingIndex(corpusRow);
-          if (corpusRow != randomStartingIndex)
+          if (corpusRow != randomStartingIndex) {
             updater.update(currentEigen, corpus.getRow(corpusRow), state);
+          }
         }
         state.setFirstPass(false);
         if (debug) {

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianUpdater.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianUpdater.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianUpdater.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/hebbian/HebbianUpdater.java Mon Apr 19 12:24:54 2010
@@ -50,8 +50,9 @@ public class HebbianUpdater implements E
     double activation = currentState.getActivationNumerator() / Math.sqrt(currentState.getActivationDenominatorSquared());
     currentState.setActivationDenominatorSquared(currentState.getActivationDenominatorSquared() + 2 * activation * currentState.getActivationNumerator()
         + (activation * activation) * (trainingVector.getLengthSquared() - currentState.currentTrainingProjection().getLengthSquared()));
-    if (numPreviousEigens > 0)
+    if (numPreviousEigens > 0) {
       currentState.getHelperVector().assign(currentState.currentTrainingProjection(), new PlusMult(activation));
+    }
     pseudoEigen.assign(trainingVector, new PlusMult(activation));
   }
 

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=935541&r1=935540&r2=935541&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 Apr 19 12:24:54 2010
@@ -183,8 +183,10 @@ public class LanczosSolver {
 
   private static void orthoganalizeAgainstAllButLast(Vector nextVector, Matrix basis) {
     for (int i = 0; i < basis.numRows() - 1; i++) {
-      double alpha = 0;
-      if(basis.getRow(i) == null || (alpha = nextVector.dot(basis.getRow(i))) == 0) continue;
+      double alpha;
+      if (basis.getRow(i) == null || (alpha = nextVector.dot(basis.getRow(i))) == 0.0) {
+        continue;
+      }
       nextVector.assign(basis.getRow(i), new PlusMult(-alpha));
     }
   }
@@ -212,7 +214,9 @@ public class LanczosSolver {
   }
 
   private void endTime(TimingSection section) {
-    if (!times.containsKey(section)) times.put(section, 0L);
+    if (!times.containsKey(section)) {
+      times.put(section, 0L);
+    }
     times.put(section, times.get(section) + (System.nanoTime() - startTimes.get(section)));
   }
 

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory2D.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory2D.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory2D.java Mon Apr 19 12:24:54 2010
@@ -603,7 +603,7 @@ public class DoubleFactory2D extends Per
    * @throws IllegalArgumentException <tt>values.length</tt> must be a multiple of <tt>rows</tt>.
    */
   public DoubleMatrix2D make(double[] values, int rows) {
-    int columns = (rows != 0 ? values.length / rows : 0);
+    int columns = rows == 0 ? 0 : values.length / rows;
     if (rows * columns != values.length) {
       throw new IllegalArgumentException("Array length must be a multiple of m.");
     }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SingularValueDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SingularValueDecomposition.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SingularValueDecomposition.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SingularValueDecomposition.java Mon Apr 19 12:24:54 2010
@@ -266,8 +266,8 @@ public class SingularValueDecomposition 
           if (ks == k) {
             break;
           }
-          double t = (ks != p ? Math.abs(e[ks]) : 0.0) +
-              (ks != k + 1 ? Math.abs(e[ks - 1]) : 0.0);
+          double t = (ks == p ? 0.0 : Math.abs(e[ks])) +
+                     (ks == k + 1 ? 0.0 : Math.abs(e[ks - 1]));
           if (Math.abs(s[ks]) <= eps * t) {
             s[ks] = 0.0;
             break;

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=935541&r1=935540&r2=935541&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 Apr 19 12:24:54 2010
@@ -66,7 +66,9 @@ public abstract class SolverTest extends
                                  boolean isSymmetric) {
     for (int i = 0; i < numEigensToCheck; i++) {
       Vector e = eigens.getRow(i);
-      if (e.getLengthSquared() == 0) continue;
+      if (e.getLengthSquared() == 0) {
+        continue;
+      }
       Vector afterMultiply = isSymmetric ? corpus.times(e) : corpus.timesSquared(e);
       double dot = afterMultiply.dot(e);
       double afterNorm = afterMultiply.getLengthSquared();

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/hebbian/TestHebbianSolver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/hebbian/TestHebbianSolver.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/hebbian/TestHebbianSolver.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/hebbian/TestHebbianSolver.java Mon Apr 19 12:24:54 2010
@@ -39,7 +39,7 @@ public class TestHebbianSolver extends S
   public static long timeSolver(Matrix corpus,
                                 double convergence,
                                 int maxNumPasses,
-                                TrainingState state) throws Exception {
+                                TrainingState state) {
     return timeSolver(corpus,
                       convergence,
                       maxNumPasses,
@@ -71,15 +71,15 @@ public class TestHebbianSolver extends S
 
 
 
-  public static long timeSolver(Matrix corpus, TrainingState state) throws Exception {
+  public static long timeSolver(Matrix corpus, TrainingState state) {
     return timeSolver(corpus, state, 10);
   }
 
-  public static long timeSolver(Matrix corpus, TrainingState state, int rank) throws Exception {
+  public static long timeSolver(Matrix corpus, TrainingState state, int rank) {
     return timeSolver(corpus, 0.01, 20, rank, state);
   }
 
-  public void testHebbianSolver() throws Exception {
+  public void testHebbianSolver() {
     int numColumns = 800;
     Matrix corpus = randomSequentialAccessSparseMatrix(1000, 900, numColumns, 30, 1.0);
     int rank = 50;

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/lanczos/TestLanczosSolver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/lanczos/TestLanczosSolver.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/lanczos/TestLanczosSolver.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/lanczos/TestLanczosSolver.java Mon Apr 19 12:24:54 2010
@@ -53,7 +53,7 @@ public class TestLanczosSolver extends S
     assertEigen(eigens, gramMatrix, 0.1, true);
   }
 
-  public static long timeLanczos(Matrix corpus, Matrix eigens, int rank, boolean symmetric) throws Exception {
+  public static long timeLanczos(Matrix corpus, Matrix eigens, int rank, boolean symmetric) {
     long start = System.currentTimeMillis();
 
     LanczosSolver solver = new LanczosSolver();

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java Mon Apr 19 12:24:54 2010
@@ -141,8 +141,9 @@ public final class ClusterDumper {
         String fmtStr = useJSON ? cluster.asJsonString() : cluster.asFormatString(dictionary);
         if (subString > 0 && fmtStr.length() > subString) {
           writer.append(":").append(fmtStr.substring(0, Math.min(subString, fmtStr.length())));
-        } else
+        } else {
           writer.append(fmtStr);
+        }
 
         writer.append('\n');
 
@@ -361,10 +362,8 @@ public final class ClusterDumper {
   }
 
   static class TermIndexWeight {
-    int index = -1;
-
-    double weight = 0;
-
+    private int index = -1;
+    private double weight = 0.0;
     TermIndexWeight(int index, double weight) {
       this.index = index;
       this.weight = weight;

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/Gram.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/Gram.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/Gram.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/Gram.java Mon Apr 19 12:24:54 2010
@@ -42,11 +42,15 @@ public class Gram extends BinaryComparab
     UNIGRAM('u'),
     NGRAM('n');
     
-    final char x;
+    private final char x;
     
     Type(char c) {
       this.x = c;
     }
+
+    public String toString() {
+      return String.valueOf(x);
+    }
   }
 
   private byte[] bytes;
@@ -201,7 +205,7 @@ public class Gram extends BinaryComparab
   }
 
   public String toString() {
-    return '\'' + getString() + "'[" + getType().x + "]:" + frequency;
+    return '\'' + getString() + "'[" + getType() + "]:" + frequency;
   }
   
   public static void encodeType(Type type, byte[] buf, int offset) {

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKey.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKey.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKey.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKey.java Mon Apr 19 12:24:54 2010
@@ -128,6 +128,6 @@ public class GramKey extends BinaryCompa
   }
   
   public String toString() {
-    return '\'' + getPrimaryString() + "'[" + getType().x + ']';
+    return '\'' + getPrimaryString() + "'[" + getType() + ']';
   }
 }

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java Mon Apr 19 12:24:54 2010
@@ -67,10 +67,10 @@ import org.slf4j.LoggerFactory;
 public class ClusterLabels {
   
   class TermInfoClusterInOut implements Comparable<TermInfoClusterInOut> {
-    final String term;
-    final int inClusterDF;
-    final int outClusterDF;
-    double logLikelihoodRatio;
+    private final String term;
+    private final int inClusterDF;
+    private final int outClusterDF;
+    private double logLikelihoodRatio;
     
     TermInfoClusterInOut(String term, int inClusterDF, int outClusterDF) {
       this.term = term;

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java (original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java Mon Apr 19 12:24:54 2010
@@ -26,9 +26,6 @@ import junit.framework.Assert;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.SequenceFile;
-import org.apache.hadoop.io.Text;
 import org.apache.lucene.analysis.standard.StandardAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -38,14 +35,12 @@ import org.apache.lucene.store.RAMDirect
 import org.apache.lucene.util.Version;
 import org.apache.mahout.clustering.canopy.CanopyClusteringJob;
 import org.apache.mahout.clustering.canopy.CanopyDriver;
-import org.apache.mahout.clustering.dirichlet.DirichletClusterer;
 import org.apache.mahout.clustering.dirichlet.DirichletDriver;
 import org.apache.mahout.clustering.dirichlet.models.L1ModelDistribution;
 import org.apache.mahout.clustering.kmeans.KMeansDriver;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.common.distance.EuclideanDistanceMeasure;
-import org.apache.mahout.common.distance.ManhattanDistanceMeasure;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.VectorWritable;
 import org.apache.mahout.utils.clustering.ClusterDumper;
@@ -61,8 +56,6 @@ public class TestClusterDumper extends M
 
   private List<VectorWritable> sampleData;
 
-  private FileSystem fs;
-
   private static final String[] DOCS = { "The quick red fox jumped over the lazy brown dogs.",
       "The quick brown fox jumped over the lazy red dogs.", "The quick red cat jumped over the lazy brown dogs.",
       "The quick brown cat jumped over the lazy red dogs.", "Mary had a little lamb whose fleece was white as snow.",
@@ -80,7 +73,7 @@ public class TestClusterDumper extends M
     super.setUp();
     RandomUtils.useTestSeed();
     Configuration conf = new Configuration();
-    fs = FileSystem.get(conf);
+    FileSystem fs = FileSystem.get(conf);
     // Create testdata directory
     File f = new File("testdata");
     if (!f.exists()) {
@@ -99,11 +92,13 @@ public class TestClusterDumper extends M
     // Run ClusterDumper test
   }
 
-  private void rmDir(File f) {
+  private static void rmDir(File f) {
     if (f != null && f.exists()) {
-      if (f.isDirectory())
-        for (File g : f.listFiles())
+      if (f.isDirectory()) {
+        for (File g : f.listFiles()) {
           rmDir(g);
+        }
+      }
       f.delete();
     }
   }
@@ -158,7 +153,7 @@ public class TestClusterDumper extends M
   public void testDirichlet() throws Exception {
     Vector prototype = sampleData.get(0).get();
     DirichletDriver.runJob("testdata/points", "output",
-        new L1ModelDistribution(sampleData.get(0)).getClass().getName(), prototype.getClass().getName(), prototype
+        L1ModelDistribution.class.getName(), prototype.getClass().getName(), prototype
             .size(), 15, 10, 1.0, 1);
     // run ClusterDumper
     ClusterDumper clusterDumper = new ClusterDumper("output/state-10", null);

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java?rev=935541&r1=935540&r2=935541&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java (original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java Mon Apr 19 12:24:54 2010
@@ -21,7 +21,6 @@ import static org.apache.mahout.utils.nl
 import static org.apache.mahout.utils.nlp.collocations.llr.Gram.Type.TAIL;
 import static org.apache.mahout.utils.nlp.collocations.llr.Gram.Type.NGRAM;
 
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
@@ -56,8 +55,8 @@ public class LLRReducerTest {
   // to see the values emitted.
   private final OutputCollector<Text,DoubleWritable> collector = new OutputCollector<Text,DoubleWritable>() {
     @Override
-    public void collect(Text key, DoubleWritable value) throws IOException {
-      log.info(key.toString() + ' ' + value.toString());
+    public void collect(Text key, DoubleWritable value) {
+      log.info("{} {}", key, value);
     }
   };
   
@@ -69,16 +68,9 @@ public class LLRReducerTest {
     cl        = new LLCallback() {
       @Override
       public double logLikelihoodRatio(int k11, int k12, int k21, int k22) {
-        log.info("k11:" + k11 + " k12:" + k12 + " k21:" + k21 + " k22:" + k22);
-        try {
-          return LogLikelihood.logLikelihoodRatio(k11, k12, k21, k22);
-        }
-        catch (Exception e) {
-          e.printStackTrace();
-          return -1;
-        }
+        log.info("k11:{} k12:{} k21:{} k22:{}", new Object[] {k11, k12, k21, k22});
+        return LogLikelihood.logLikelihoodRatio(k11, k12, k21, k22);
       }
-      
     };
   }
   



Mime
View raw message