You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2010/01/26 04:55:29 UTC

svn commit: r903071 - in /lucene/mahout/trunk: collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/ core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/ examples/src/main/java/org/apache/mahout/clustering/fuzzykmeans/ ...

Author: srowen
Date: Tue Jan 26 03:55:27 2010
New Revision: 903071

URL: http://svn.apache.org/viewvc?rev=903071&view=rev
Log:
More attempts at code streamlining and style stuff

Modified:
    lucene/mahout/trunk/collections-codegen-plugin/src/main/java/org/apache/mahout/collection_codegen/CodeGenerator.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/fuzzykmeans/DisplayFuzzyKMeans.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/clustering/syntheticcontrol/canopy/InputDriver.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/BuildForest.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleCombiner.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleGrouper.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleMapper.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleReducer.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.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/hadoop/DatasetSplitTest.java
    lucene/mahout/trunk/math/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeObjectMap.java.t
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.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/jet/stat/Gamma.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleBufferSet.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/KnownDoubleQuantileEstimator.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractObjectList.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory1D.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/doublealgo/Statistic.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractFormatter.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Algebra.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SingularValueDecomposition.java
    lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/list/ValueTypeArrayListTest.java.t
    lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeObjectHashMapTest.java.t
    lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeValueTypeHashMapTest.java.t
    lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenObjectValueTypeHashMapTest.java.t
    lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/set/OpenKeyTypeHashSetTest.java.t
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/MatrixTest.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.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/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/Driver.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/text/PartialVectorGenerator.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -49,7 +49,7 @@
   
   private static final String[] NO_STRINGS = {null};
   private static final Charset UTF8 = Charset.forName("utf-8");
-  private Map<String,String> typeToObjectTypeMap;
+  private final Map<String,String> typeToObjectTypeMap;
   
   /**
    * @parameter default-value="${basedir}/src/test/java-templates"
@@ -127,9 +127,8 @@
    * @required
    */
   private MavenProject project;
-  private VelocityEngine mainVelocityEngine;
   private VelocityEngine testVelocityEngine;
-  private FileSetManager fileSetManager;
+  private final FileSetManager fileSetManager;
   
   public CodeGenerator() {
     typeToObjectTypeMap = new HashMap<String,String>();
@@ -144,6 +143,7 @@
     fileSetManager = new FileSetManager(getLog());
   }
   
+  @Override
   public void execute() throws MojoExecutionException {
     File f = outputDirectory;
     
@@ -154,8 +154,8 @@
     if (testOutputDirectory != null && !testOutputDirectory.exists()) {
       testOutputDirectory.mkdirs();
     }
-    
-    mainVelocityEngine = new VelocityEngine();
+
+    VelocityEngine mainVelocityEngine = new VelocityEngine();
     mainVelocityEngine.setProperty("file.resource.loader.path", sourceTemplateRoot);
     if (testTemplateRoot != null) {
       testVelocityEngine = new VelocityEngine();

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java Tue Jan 26 03:55:27 2010
@@ -399,7 +399,7 @@
     return frequentPatterns;
   }
 
-  private FrequentPatternMaxHeap growthTopDown(FPTree tree, MutableLong minSupportMutable, int k,
+  private static FrequentPatternMaxHeap growthTopDown(FPTree tree, MutableLong minSupportMutable, int k,
       FPTreeDepthCache treeCache, int level, boolean conditionalOfCurrentAttribute, int currentAttribute,
       StatusUpdater updater) {
 

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/fuzzykmeans/DisplayFuzzyKMeans.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/fuzzykmeans/DisplayFuzzyKMeans.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/fuzzykmeans/DisplayFuzzyKMeans.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/fuzzykmeans/DisplayFuzzyKMeans.java Tue Jan 26 03:55:27 2010
@@ -26,7 +26,6 @@
 
 import org.apache.mahout.clustering.canopy.Canopy;
 import org.apache.mahout.clustering.dirichlet.DisplayDirichlet;
-import org.apache.mahout.clustering.kmeans.Cluster;
 import org.apache.mahout.math.DenseVector;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.common.distance.DistanceMeasure;

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -38,7 +38,8 @@
     this.setTitle("Canopy Clusters (> 1.5% of population)");
   }
 
-  private static MeanShiftCanopyClusterer clusterer = new MeanShiftCanopyClusterer(new EuclideanDistanceMeasure(), 1.0, 0.05, 0.5);
+  private static final MeanShiftCanopyClusterer clusterer =
+      new MeanShiftCanopyClusterer(new EuclideanDistanceMeasure(), 1.0, 0.05, 0.5);
   private static List<MeanShiftCanopy> canopies = new ArrayList<MeanShiftCanopy>();
 
   // TODO this is never queried?

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java Tue Jan 26 03:55:27 2010
@@ -35,7 +35,6 @@
 import org.apache.hadoop.mapred.SequenceFileOutputFormat;
 import org.apache.mahout.common.CommandLineUtil;
 import org.apache.mahout.common.commandline.DefaultOptionCreator;
-import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.VectorWritable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java Tue Jan 26 03:55:27 2010
@@ -160,12 +160,10 @@
    * @param alpha_0 the double alpha_0 value
    * @throws InvocationTargetException 
    * @throws NoSuchMethodException 
-   * @throws IllegalArgumentException 
-   * @throws SecurityException 
-   * @throws NumberFormatException 
+   * @throws SecurityException
    */
   public static void printResults(String output, String modelDistribution, String vectorClassName, int prototypeSize,
-      int numIterations, int numModels, double alpha_0) throws NumberFormatException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+      int numIterations, int numModels, double alpha_0) throws SecurityException, NoSuchMethodException, InvocationTargetException {
     List<List<DirichletCluster<VectorWritable>>> clusters = new ArrayList<List<DirichletCluster<VectorWritable>>>();
     JobConf conf = new JobConf(KMeansDriver.class);
     conf.set(DirichletDriver.MODEL_FACTORY_KEY, modelDistribution);

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/BuildForest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/BuildForest.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/BuildForest.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapreduce/BuildForest.java Tue Jan 26 03:55:27 2010
@@ -219,7 +219,7 @@
     return forest;
   }
 
-  protected Data loadData(Configuration conf, Path dataPath, Dataset dataset) throws IOException {
+  protected static Data loadData(Configuration conf, Path dataPath, Dataset dataset) throws IOException {
     log.info("Loading the data...");
     FileSystem fs = dataPath.getFileSystem(conf);
     Data data = DataLoader.loadData(dataset, fs, dataPath);

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleCombiner.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleCombiner.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleCombiner.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleCombiner.java Tue Jan 26 03:55:27 2010
@@ -27,6 +27,7 @@
 public class KeyBasedStringTupleCombiner extends
     Reducer<Text, StringTuple, Text, StringTuple> {
 
+  @Override
   protected void reduce(Text key, Iterable<StringTuple> values,
       Context context) throws IOException, InterruptedException {
     HashSet<String> outputValues = new HashSet<String>();
@@ -34,6 +35,6 @@
       outputValues.addAll(value.getEntries());
     }
     context.write(key, new StringTuple(outputValues));
-  };
+  }
 }
 

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleGrouper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleGrouper.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleGrouper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleGrouper.java Tue Jan 26 03:55:27 2010
@@ -50,8 +50,7 @@
 
 public class KeyBasedStringTupleGrouper {
 
-
-  public void startJob(Parameters params) throws IOException,
+  public static void startJob(Parameters params) throws IOException,
       InterruptedException, ClassNotFoundException {
     Configuration conf = new Configuration();
     

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleMapper.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleMapper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleMapper.java Tue Jan 26 03:55:27 2010
@@ -40,6 +40,7 @@
 
   private int[] groupingFields = null;
 
+  @Override
   protected void map(LongWritable key, Text value, Context context) throws IOException,
       InterruptedException {
     String[] fields = splitter.split(value.toString());
@@ -63,6 +64,7 @@
 
   }
 
+  @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);
     Parameters params = Parameters.fromString(context.getConfiguration().get("job.parameters", ""));

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleReducer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleReducer.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleReducer.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/dataset/KeyBasedStringTupleReducer.java Tue Jan 26 03:55:27 2010
@@ -30,6 +30,7 @@
 
   private int maxTransactionLength = 100;
 
+  @Override
   protected void reduce(Text key, Iterable<StringTuple> values, Context context) throws IOException,
       InterruptedException {
     Set<String> items = new HashSet<String>();
@@ -62,8 +63,9 @@
         context.write(null, new Text(sb.toString()));
       }
     }
-  };
+  }
 
+  @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);
     Parameters params = Parameters.fromString(context.getConfiguration().get("job.parameters", ""));

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java Tue Jan 26 03:55:27 2010
@@ -67,14 +67,14 @@
     writer.close();
   }
   
-  public class ChunkedWriter implements Closeable {
-    int maxChunkSizeInBytes;
-    String outputDir;
-    SequenceFile.Writer writer;
-    int currentChunkID;
-    int currentChunkSize;
-    Configuration conf = new Configuration();
-    FileSystem fs;
+  public static class ChunkedWriter implements Closeable {
+    private final int maxChunkSizeInBytes;
+    private final String outputDir;
+    private SequenceFile.Writer writer;
+    private int currentChunkID;
+    private int currentChunkSize;
+    private final Configuration conf = new Configuration();
+    private final FileSystem fs;
     
     public ChunkedWriter(int chunkSizeInMB, String outputDir) throws IOException {
       if (chunkSizeInMB < 64) {
@@ -117,9 +117,9 @@
   }
   
   public class PrefixAdditionFilter implements FileFilter {
-    String prefix;
-    ChunkedWriter writer;
-    Charset charset;
+    private final String prefix;
+    private final ChunkedWriter writer;
+    private final Charset charset;
     
     public PrefixAdditionFilter(String prefix,
                                 ChunkedWriter writer,
@@ -137,11 +137,9 @@
             + current.getName(), writer, charset));
       } else {
         try {
-          FileLineIterable fit = new FileLineIterable(current, charset, false);
           StringBuilder file = new StringBuilder();
-          Iterator<String> it = fit.iterator();
-          while (it.hasNext()) {
-            file.append(it.next()).append("\n");
+          for (String aFit : new FileLineIterable(current, charset, false)) {
+            file.append(aFit).append('\n');
           }
           writer.write(prefix + File.separator + current.getName(), file
               .toString());
@@ -211,8 +209,7 @@
     
     int chunkSize = 64;
     if (cmdLine.hasOption(chunkSizeOpt)) {
-      chunkSize =
-          Integer.valueOf((String) cmdLine.getValue(chunkSizeOpt)).intValue();
+      chunkSize = Integer.parseInt((String) cmdLine.getValue(chunkSizeOpt));
     }
     
     String prefix = "";

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java Tue Jan 26 03:55:27 2010
@@ -33,7 +33,10 @@
  * 
  */
 public final class SparseVectorsFromSequenceFiles {
-  
+
+  private SparseVectorsFromSequenceFiles() {
+  }
+
   public static void main(String[] args) throws Exception {
     DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
     ArgumentBuilder abuilder = new ArgumentBuilder();
@@ -85,8 +88,7 @@
     
     int chunkSize = 100;
     if (cmdLine.hasOption(chunkSizeOpt)) {
-      chunkSize =
-          Integer.valueOf((String) cmdLine.getValue(chunkSizeOpt)).intValue();
+      chunkSize = Integer.parseInt((String) cmdLine.getValue(chunkSizeOpt));
     }
     int minSupport = 2;
     if (cmdLine.hasOption(minSupportOpt)) {

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java Tue Jan 26 03:55:27 2010
@@ -33,7 +33,6 @@
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.util.GenericsUtil;
-import org.apache.lucene.analysis.Analyzer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,7 +64,7 @@
                   Reporter reporter) throws IOException {
     
     String content = value.toString();
-    if (content.indexOf(REDIRECT) != -1) return;
+    if (content.contains(REDIRECT)) return;
     String document = "";
     String title = "";
     try {
@@ -87,13 +86,13 @@
     
   }
   
-  private String getDocument(String xml) {
+  private static String getDocument(String xml) {
     int start = xml.indexOf(START_DOC) + START_DOC.length();
     int end = xml.indexOf(END_DOC, start);
     return xml.substring(start, end);
   }
   
-  private String getTitle(String xml) {
+  private static String getTitle(String xml) {
     Matcher m = TITLE.matcher(xml);
     String ret = "";
     if (m.find()) {

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -17,7 +17,6 @@
 
 package org.apache.mahout.ga.watchmaker.cd;
 
-import junit.framework.TestCase;
 import junit.framework.Assert;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.ga.watchmaker.cd.utils.MockDataSet;

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplitTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplitTest.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplitTest.java (original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplitTest.java Tue Jan 26 03:55:27 2010
@@ -27,7 +27,6 @@
 import org.uncommons.maths.random.MersenneTwisterRNG;
 
 import java.io.IOException;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 

Modified: lucene/mahout/trunk/math/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeObjectMap.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeObjectMap.java.t?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeObjectMap.java.t (original)
+++ lucene/mahout/trunk/math/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeObjectMap.java.t Tue Jan 26 03:55:27 2010
@@ -290,8 +290,8 @@
       tempValueList[i] = get(keyList.getQuick(i));
     }
     valueList.clear();
-    for (int i = 0; i < tempValueList.length; i ++) {
-      valueList.add(tempValueList[i]);
+    for (T value : tempValueList) {
+      valueList.add(value);
     }
     
   }
@@ -311,7 +311,7 @@
     keys(keyList);
     values(valueList);
     
-    if (valueList.size() > 0 && !(valueList.get(0) instanceof Comparable)) {
+    if (!valueList.isEmpty() && !(valueList.get(0) instanceof Comparable)) {
       throw new UnsupportedOperationException("Cannot sort the values; " 
           + valueList.get(0).getClass()
           + " does not implement Comparable");

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java Tue Jan 26 03:55:27 2010
@@ -463,16 +463,16 @@
 
   protected class TransposeViewVector extends AbstractVector {
 
-    protected Matrix matrix;
-    protected int transposeOffset;
-    protected int numCols;
-    private boolean rowToColumn;
+    private final Matrix matrix;
+    private final int transposeOffset;
+    private final int numCols;
+    private final boolean rowToColumn;
 
-    public TransposeViewVector(Matrix m, int offset) {
+    protected TransposeViewVector(Matrix m, int offset) {
       this(m, offset, true);
     }
 
-    public TransposeViewVector(Matrix m, int offset, boolean rowToColumn) {
+    protected TransposeViewVector(Matrix m, int offset, boolean rowToColumn) {
       matrix = m;
       this.transposeOffset = offset;
       this.rowToColumn = rowToColumn;

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -50,7 +50,7 @@
   private final Random rng = new Random();
 
   private int numPasses = 0;
-  private final boolean debug = false;
+  private static final boolean debug = false;
 
   /**
    * Creates a new HebbianSolver
@@ -142,7 +142,7 @@
    *                          before the solver will move on to the next eigen-vector.
    */
   public HebbianSolver(int numPassesPerEigen) {
-    this(0d, numPassesPerEigen);
+    this(0.0, numPassesPerEigen);
   }
 
   /**

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Gamma.java Tue Jan 26 03:55:27 2010
@@ -110,7 +110,7 @@
     while (x < 0.0) {
       if (x == 0.0) {
         throw new ArithmeticException("gamma: singular");
-      } else if (x > -1.E-9) {
+      } else if (x > -1.0e-9) {
         return (z / ((1.0 + 0.5772156649015329 * x) * x));
       }
       z /= x;
@@ -120,7 +120,7 @@
     while (x < 2.0) {
       if (x == 0.0) {
         throw new ArithmeticException("gamma: singular");
-      } else if (x < 1.e-9) {
+      } else if (x < 1.0e-9) {
         return (z / ((1.0 + 0.5772156649015329 * x) * x));
       }
       z /= x;

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/Probability.java Tue Jan 26 03:55:27 2010
@@ -8,11 +8,12 @@
 */
 package org.apache.mahout.math.jet.stat;
 
+import org.apache.mahout.math.jet.math.Constants;
 import org.apache.mahout.math.jet.math.Polynomial;
 
 /** @deprecated until unit tests are in place.  Until this time, this class/interface is unsupported. */
 @Deprecated
-public class Probability extends org.apache.mahout.math.jet.math.Constants {
+public class Probability extends Constants {
 
   /**
    * ********************************************** COEFFICIENTS FOR METHOD  normalInverse()   *
@@ -766,7 +767,7 @@
 
       // Calculate function value at x3
       double f3 = studentT(size, x3) - cumProb;
-      if (Math.abs(f3) < 1e-8) { // This criteria needs to be very tight!
+      if (Math.abs(f3) < 1.0e-8) { // This criteria needs to be very tight!
         // We found a perfect value -> return
         return x3;
       }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleBufferSet.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleBufferSet.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleBufferSet.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleBufferSet.java Tue Jan 26 03:55:27 2010
@@ -240,7 +240,7 @@
    * @param triggerPositions the positions of elements within the sorted sequence to be retrieved
    * @return outputValues a list filled with the values at triggerPositions
    */
-  protected double[] getValuesAtPositions(DoubleBuffer[] buffers, long[] triggerPositions) {
+  protected static double[] getValuesAtPositions(DoubleBuffer[] buffers, long[] triggerPositions) {
 
     // sort buffers.
     for (int i = buffers.length; --i >= 0;) {

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/KnownDoubleQuantileEstimator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/KnownDoubleQuantileEstimator.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/KnownDoubleQuantileEstimator.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/KnownDoubleQuantileEstimator.java Tue Jan 26 03:55:27 2010
@@ -244,7 +244,7 @@
    * @param infinities the number of infinities previously filled.
    * @param buffer     the buffer into which the infinities were filled.
    */
-  protected void removeInfinitiesFrom(int infinities, DoubleBuffer buffer) {
+  protected static void removeInfinitiesFrom(int infinities, DoubleBuffer buffer) {
     int plusInf = 0;
     int minusInf = 0;
     // count them (this is not very clever but it's safe)

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractObjectList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractObjectList.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractObjectList.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractObjectList.java Tue Jan 26 03:55:27 2010
@@ -36,7 +36,7 @@
 
  @author wolfgang.hoschek@cern.ch
  @version 1.0, 09/24/99
- @see     ArrayList
+ @see      java.util.ArrayList
  @see      java.util.Vector
  @see      java.util.Arrays
  */

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory1D.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory1D.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleFactory1D.java Tue Jan 26 03:55:27 2010
@@ -154,7 +154,7 @@
    * @see org.apache.mahout.math.jet.random.sampling.RandomSampler
    */
   public DoubleMatrix1D sample(int size, double value, double nonZeroFraction) {
-    double epsilon = 1e-09;
+    double epsilon = 1.0e-9;
     if (nonZeroFraction < 0 - epsilon || nonZeroFraction > 1 + epsilon) {
       throw new IllegalArgumentException();
     }

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -703,7 +703,7 @@
   public DoubleMatrix2D sample(DoubleMatrix2D matrix, double value, double nonZeroFraction) {
     int rows = matrix.rows();
     int columns = matrix.columns();
-    double epsilon = 1e-09;
+    double epsilon = 1.0e-9;
     if (nonZeroFraction < 0 - epsilon || nonZeroFraction > 1 + epsilon) {
       throw new IllegalArgumentException();
     }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Statistic.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Statistic.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Statistic.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Statistic.java Tue Jan 26 03:55:27 2010
@@ -409,7 +409,7 @@
    */
   public static DoubleMatrix1D viewSample(DoubleMatrix1D matrix, double fraction, RandomEngine randomGenerator) {
     // check preconditions and allow for a little tolerance
-    double epsilon = 1e-09;
+    double epsilon = 1.0e-09;
     if (fraction < 0 - epsilon || fraction > 1 + epsilon) {
       throw new IllegalArgumentException();
     }
@@ -476,7 +476,7 @@
   public static DoubleMatrix2D viewSample(DoubleMatrix2D matrix, double rowFraction, double columnFraction,
                                           RandomEngine randomGenerator) {
     // check preconditions and allow for a little tolerance
-    double epsilon = 1e-09;
+    double epsilon = 1.0e-09;
     if (rowFraction < 0 - epsilon || rowFraction > 1 + epsilon) {
       throw new IllegalArgumentException();
     }
@@ -547,7 +547,7 @@
   public static DoubleMatrix3D viewSample(DoubleMatrix3D matrix, double sliceFraction, double rowFraction,
                                           double columnFraction, RandomEngine randomGenerator) {
     // check preconditions and allow for a little tolerance
-    double epsilon = 1e-09;
+    double epsilon = 1.0e-09;
     if (sliceFraction < 0 - epsilon || sliceFraction > 1 + epsilon) {
       throw new IllegalArgumentException();
     }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractFormatter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractFormatter.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractFormatter.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractFormatter.java Tue Jan 26 03:55:27 2010
@@ -133,7 +133,7 @@
   }
 
   /** Converts a row into a string. */
-  protected int alignmentCode(String alignment) {
+  protected static int alignmentCode(String alignment) {
     //{-1,0,1,2} = {left,centered,right,decimal point}
     if (alignment.equals(LEFT)) {
       return -1;
@@ -188,7 +188,7 @@
   }
 
   /** Returns a String with <tt>length</tt> blanks. */
-  protected String blanks(int length) {
+  protected static String blanks(int length) {
     if (length < 0) {
       length = 0;
     }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Algebra.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Algebra.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Algebra.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Algebra.java Tue Jan 26 03:55:27 2010
@@ -231,7 +231,7 @@
   }
 
   /** Returns the one-norm of matrix <tt>A</tt>, which is the maximum absolute column sum. */
-  public double norm1(DoubleMatrix2D A) {
+  public static double norm1(DoubleMatrix2D A) {
     double max = 0;
     for (int column = A.columns(); --column >= 0;) {
       max = Math.max(max, norm1(A.viewColumn(column)));
@@ -240,7 +240,7 @@
   }
 
   /** Returns the two-norm (aka <i>euclidean norm</i>) of vector <tt>x</tt>; equivalent to <tt>mult(x,x)</tt>. */
-  public double norm2(DoubleMatrix1D x) {
+  public static double norm2(DoubleMatrix1D x) {
     return mult(x, x);
   }
 
@@ -274,7 +274,7 @@
   }
 
   /** Returns the infinity norm of matrix <tt>A</tt>, which is the maximum absolute row sum. */
-  public double normInfinity(DoubleMatrix2D A) {
+  public static double normInfinity(DoubleMatrix2D A) {
     double max = 0;
     for (int row = A.rows(); --row >= 0;) {
       //max = Math.max(max, normInfinity(A.viewRow(row)));
@@ -356,7 +356,7 @@
    * @return the modified <tt>A</tt> (for convenience only).
    * @throws IndexOutOfBoundsException if <tt>indexes.length != A.columns()</tt>.
    */
-  public DoubleMatrix2D permuteColumns(DoubleMatrix2D A, int[] indexes, int[] work) {
+  public static DoubleMatrix2D permuteColumns(DoubleMatrix2D A, int[] indexes, int[] work) {
     return permuteRows(A.viewDice(), indexes, work);
   }
 
@@ -383,7 +383,7 @@
    * @return the modified <tt>A</tt> (for convenience only).
    * @throws IndexOutOfBoundsException if <tt>indexes.length != A.rows()</tt>.
    */
-  public DoubleMatrix2D permuteRows(final DoubleMatrix2D A, int[] indexes, int[] work) {
+  public static DoubleMatrix2D permuteRows(final DoubleMatrix2D A, int[] indexes, int[] work) {
     // check validity
     int size = A.rows();
     if (indexes.length != size) {
@@ -548,7 +548,7 @@
    *
    * @return X; a new independent matrix; solution if A is square, least squares solution otherwise.
    */
-  public DoubleMatrix2D solveTranspose(DoubleMatrix2D A, DoubleMatrix2D B) {
+  public static DoubleMatrix2D solveTranspose(DoubleMatrix2D A, DoubleMatrix2D B) {
     return solve(transpose(A), transpose(B));
   }
 
@@ -650,7 +650,7 @@
    * trace         : 0
    * </pre>
    */
-  public String toString(DoubleMatrix2D matrix) {
+  public static String toString(DoubleMatrix2D matrix) {
     final ObjectArrayList<String> names = new ObjectArrayList<String>();
     final ObjectArrayList<String> values = new ObjectArrayList<String>();
 
@@ -909,7 +909,7 @@
    * 0.631761  0.532513  0.563301
    * </pre>
    */
-  public String toVerboseString(DoubleMatrix2D matrix) {
+  public static String toVerboseString(DoubleMatrix2D matrix) {
 /*
   StringBuffer buf = new StringBuffer();
   String unknown = "Illegal operation or error: ";

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java Tue Jan 26 03:55:27 2010
@@ -318,7 +318,7 @@
    *
    * @return <tt>A</tt> (for convenience only).
    */
-  protected DoubleMatrix2D lowerTriangular(DoubleMatrix2D A) {
+  protected static DoubleMatrix2D lowerTriangular(DoubleMatrix2D A) {
     int rows = A.rows();
     int columns = A.columns();
     int min = Math.min(rows, columns);
@@ -338,16 +338,10 @@
     return A;
   }
 
-  /**
-   *
-   */
   protected int m() {
     return LU.rows();
   }
 
-  /**
-   *
-   */
   protected int n() {
     return LU.columns();
   }
@@ -673,7 +667,7 @@
    *
    * @return <tt>A</tt> (for convenience only).
    */
-  protected DoubleMatrix2D upperTriangular(DoubleMatrix2D A) {
+  protected static DoubleMatrix2D upperTriangular(DoubleMatrix2D A) {
     int rows = A.rows();
     int columns = A.columns();
     int min = Math.min(rows, columns);

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java Tue Jan 26 03:55:27 2010
@@ -63,7 +63,7 @@
    *
    * @throws IllegalArgumentException if <tt>A.rows() < A.columns()</tt>.
    */
-  public void checkRectangular(AbstractMatrix2D A) {
+  public static void checkRectangular(AbstractMatrix2D A) {
     if (A.rows() < A.columns()) {
       throw new IllegalArgumentException("Matrix must be rectangular: " + AbstractFormatter.shape(A));
     }
@@ -74,14 +74,14 @@
    *
    * @throws IllegalArgumentException if <tt>A.rows() != A.columns()</tt>.
    */
-  public void checkSquare(AbstractMatrix2D A) {
+  public static void checkSquare(AbstractMatrix2D A) {
     if (A.rows() != A.columns()) {
       throw new IllegalArgumentException("Matrix must be square: " + AbstractFormatter.shape(A));
     }
   }
 
   /** Returns the matrix's fraction of non-zero cells; <tt>A.cardinality() / A.size()</tt>. */
-  public double density(DoubleMatrix2D A) {
+  public static double density(DoubleMatrix2D A) {
     return A.cardinality() / (double) A.size();
   }
 
@@ -315,7 +315,7 @@
    * @param A the square matrix to modify.
    * @throws IllegalArgumentException if <tt>!isSquare(A)</tt>.
    */
-  public void generateNonSingular(DoubleMatrix2D A) {
+  public static void generateNonSingular(DoubleMatrix2D A) {
     checkSquare(A);
     int min = Math.min(A.rows(), A.columns());
     for (int i = min; --i >= 0;) {
@@ -357,7 +357,7 @@
    * true if for all i: abs(A[i,i]) &gt; Sum(abs(A[j,i])); j != i.</tt> Matrix may but need not be square. <p> Note:
    * Ignores tolerance.
    */
-  public boolean isDiagonallyDominantByColumn(DoubleMatrix2D A) {
+  public static boolean isDiagonallyDominantByColumn(DoubleMatrix2D A) {
     //double epsilon = tolerance();
     int min = Math.min(A.rows(), A.columns());
     for (int i = min; --i >= 0;) {
@@ -376,7 +376,7 @@
    * all i: abs(A[i,i]) &gt; Sum(abs(A[i,j])); j != i.</tt> Matrix may but need not be square. <p> Note: Ignores
    * tolerance.
    */
-  public boolean isDiagonallyDominantByRow(DoubleMatrix2D A) {
+  public static boolean isDiagonallyDominantByRow(DoubleMatrix2D A) {
     //double epsilon = tolerance();
     int min = Math.min(A.rows(), A.columns());
     for (int i = min; --i >= 0;) {
@@ -456,7 +456,7 @@
    * A matrix <tt>A</tt> is <i>non-negative</i> if <tt>A[i,j] &gt;= 0</tt> holds for all cells. <p> Note: Ignores
    * tolerance.
    */
-  public boolean isNonNegative(DoubleMatrix2D A) {
+  public static boolean isNonNegative(DoubleMatrix2D A) {
     int rows = A.rows();
     int columns = A.columns();
     for (int row = rows; --row >= 0;) {
@@ -481,7 +481,7 @@
   }
 
   /** A matrix <tt>A</tt> is <i>positive</i> if <tt>A[i,j] &gt; 0</tt> holds for all cells. <p> Note: Ignores tolerance. */
-  public boolean isPositive(DoubleMatrix2D A) {
+  public static boolean isPositive(DoubleMatrix2D A) {
     int rows = A.rows();
     int columns = A.columns();
     for (int row = rows; --row >= 0;) {
@@ -522,7 +522,7 @@
   }
 
   /** A matrix <tt>A</tt> is <i>square</i> if it has the same number of rows and columns. */
-  public boolean isSquare(AbstractMatrix2D A) {
+  public static boolean isSquare(AbstractMatrix2D A) {
     return A.rows() == A.columns();
   }
 

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -266,8 +266,8 @@
           if (ks == k) {
             break;
           }
-          double t = (ks != p ? Math.abs(e[ks]) : 0.) +
-              (ks != k + 1 ? Math.abs(e[ks - 1]) : 0.);
+          double t = (ks != p ? Math.abs(e[ks]) : 0.0) +
+              (ks != k + 1 ? Math.abs(e[ks - 1]) : 0.0);
           if (Math.abs(s[ks]) <= eps * t) {
             s[ks] = 0.0;
             break;

Modified: lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/list/ValueTypeArrayListTest.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/list/ValueTypeArrayListTest.java.t?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/list/ValueTypeArrayListTest.java.t (original)
+++ lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/list/ValueTypeArrayListTest.java.t Tue Jan 26 03:55:27 2010
@@ -92,18 +92,18 @@
   
   @Test 
   public void testElements() {
-    ${valueType}[] l = new ${valueType}[] { 12, 24, 36, 48 };
+    ${valueType}[] l = { 12, 24, 36, 48 };
     ${valueTypeCap}ArrayList lar = new ${valueTypeCap}ArrayList(l);
     assertEquals(4, lar.size());
     assertSame(l, lar.elements());
-    ${valueType}[] l2 = new ${valueType}[] { 3, 6, 9, 12 };
+    ${valueType}[] l2 = { 3, 6, 9, 12 };
     lar.elements(l2);
     assertSame(l2, lar.elements());
   }
   
   @Test
   public void testEquals() {
-    ${valueType}[] l = new ${valueType}[] { 12, 24, 36, 48 };
+    ${valueType}[] l = { 12, 24, 36, 48 };
     ${valueTypeCap}ArrayList lar = new ${valueTypeCap}ArrayList(l);
     ${valueTypeCap}ArrayList lar2 = new ${valueTypeCap}ArrayList();
     for (int x = 0; x < lar.size(); x++) {

Modified: lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeObjectHashMapTest.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeObjectHashMapTest.java.t?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeObjectHashMapTest.java.t (original)
+++ lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeObjectHashMapTest.java.t Tue Jan 26 03:55:27 2010
@@ -43,7 +43,7 @@
   
   private static class TestClass implements Comparable<TestClass>{
     
-    public TestClass(${keyType} x) {
+    TestClass(${keyType} x) {
       this.x = x;
     }
     
@@ -354,7 +354,7 @@
     map.put((${keyType}) 14, anotherItem4);
     map.removeKey((${keyType}) 13);
     Open${keyTypeCap}ObjectHashMap<TestClass> map2 = (Open${keyTypeCap}ObjectHashMap<TestClass>) map.copy();
-    assertTrue(map.equals(map2));
+    assertEquals(map, map2);
     assertTrue(map2.equals(map));
     assertFalse("Hello Sailor".equals(map));
     assertFalse(map.equals("hello sailor"));

Modified: lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeValueTypeHashMapTest.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeValueTypeHashMapTest.java.t?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeValueTypeHashMapTest.java.t (original)
+++ lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenKeyTypeValueTypeHashMapTest.java.t Tue Jan 26 03:55:27 2010
@@ -315,7 +315,7 @@
     map.put(($keyType) 14, (${valueType}) 25);
     map.removeKey(($keyType) 13);
     Open${keyTypeCap}${valueTypeCap}HashMap map2 = (Open${keyTypeCap}${valueTypeCap}HashMap) map.copy();
-    assertTrue(map.equals(map2));
+    assertEquals(map, map2);
     assertTrue(map2.equals(map));
     assertFalse("Hello Sailor".equals(map));
     assertFalse(map.equals("hello sailor"));

Modified: lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenObjectValueTypeHashMapTest.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenObjectValueTypeHashMapTest.java.t?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenObjectValueTypeHashMapTest.java.t (original)
+++ lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/map/OpenObjectValueTypeHashMapTest.java.t Tue Jan 26 03:55:27 2010
@@ -337,7 +337,7 @@
     map.put("Fourteen", (${valueType}) 14);
     map.removeKey("Thirteen");
     OpenObject${valueTypeCap}HashMap<String> map2 = (OpenObject${valueTypeCap}HashMap<String>) map.copy();
-    assertTrue(map.equals(map2));
+    assertEquals(map, map2);
     assertTrue(map2.equals(map));
     assertFalse("Hello Sailor".equals(map));
     assertFalse(map.equals("hello sailor"));

Modified: lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/set/OpenKeyTypeHashSetTest.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/set/OpenKeyTypeHashSetTest.java.t?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/set/OpenKeyTypeHashSetTest.java.t (original)
+++ lucene/mahout/trunk/math/src/test/java-templates/org/apache/mahout/math/set/OpenKeyTypeHashSetTest.java.t Tue Jan 26 03:55:27 2010
@@ -30,7 +30,6 @@
 import org.apache.mahout.math.function.${keyTypeCap}Procedure;
 import org.apache.mahout.math.list.${keyTypeCap}ArrayList;
 import org.apache.mahout.math.map.PrimeFinder;
-import org.apache.mahout.math.set.AbstractSet;
 
 import org.junit.Assert;
 import org.junit.Test;

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/MatrixTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/MatrixTest.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/MatrixTest.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/MatrixTest.java Tue Jan 26 03:55:27 2010
@@ -398,7 +398,7 @@
         assertTrue("Matrix times transpose not correct: " + i + ", " + j
             + "\nexpected:\n\t" + expected.asFormatString() + "\nactual:\n\t"
             + value.asFormatString(),
-            Math.abs(expected.get(i, j) - value.get(i, j)) < 1e-12);
+            Math.abs(expected.get(i, j) - value.get(i, j)) < 1.0e-12);
       }
     }
 
@@ -413,7 +413,7 @@
     Vector expected = new DenseVector(new double[]{5.0, 11.0, 17.0});
     assertTrue("Matrix times vector not equals: " + vectorA.asFormatString()
         + " != " + testTimesVectorA.asFormatString(),
-        expected.minus(testTimesVectorA).norm(2) < 1e-12);
+        expected.minus(testTimesVectorA).norm(2) < 1.0e-12);
     try {
       test.times(testTimesVectorA);
       fail("Cardinalities do not match, should throw exception");
@@ -428,7 +428,7 @@
     Vector ttASlow = test.transpose().times(test.times(vectorA));
     assertTrue("M'Mv != M.timesSquared(v): " + ttA.asFormatString()
         + " != " + ttASlow.asFormatString(),
-        ttASlow.minus(ttA).norm(2) < 1e-12);
+        ttASlow.minus(ttA).norm(2) < 1.0e-12);
 
   }
 

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java Tue Jan 26 03:55:27 2010
@@ -60,47 +60,42 @@
     assertEquals("equals didn't work", randomAccessLeft, right);
     assertEquals("equals didn't work", sequentialAccessLeft, right);
     assertEquals("equals didn't work", sequentialAccessLeft, randomAccessLeft);
-    assertEquals("equivalent didn't work", false,
-            AbstractVector.strictEquivalence(randomAccessLeft, right));
-    assertEquals("equivalent didn't work", false,
-            AbstractVector.strictEquivalence(randomAccessLeft, sequentialAccessLeft));
-    assertEquals("equivalent didn't work", false,
-            AbstractVector.strictEquivalence(sequentialAccessLeft, right));
+    assertFalse("equivalent didn't work", AbstractVector.strictEquivalence(randomAccessLeft, right));
+    assertFalse("equivalent didn't work", AbstractVector.strictEquivalence(randomAccessLeft, sequentialAccessLeft));
+    assertFalse("equivalent didn't work", AbstractVector.strictEquivalence(sequentialAccessLeft, right));
 
     DenseVector leftBar = new DenseVector("bar", 3);
     leftBar.setQuick(0, 1);
     leftBar.setQuick(1, 2);
     leftBar.setQuick(2, 3);
     assertTrue("equivalent didn't work", AbstractVector.equivalent(leftBar, right));
-    assertEquals("equals didn't work", false, leftBar.equals(right));
-    assertEquals("equivalent didn't work", false,
-            AbstractVector.strictEquivalence(randomAccessLeft, right));
-    assertEquals("equivalent didn't work", false,
-            AbstractVector.strictEquivalence(sequentialAccessLeft, right));
+    assertFalse("equals didn't work", leftBar.equals(right));
+    assertFalse("equivalent didn't work", AbstractVector.strictEquivalence(randomAccessLeft, right));
+    assertFalse("equivalent didn't work", AbstractVector.strictEquivalence(sequentialAccessLeft, right));
 
     RandomAccessSparseVector rightBar = new RandomAccessSparseVector("bar", 3);
     rightBar.setQuick(0, 1);
     rightBar.setQuick(1, 2);
     rightBar.setQuick(2, 3);
     assertTrue("equivalent didn't work", AbstractVector.equivalent(randomAccessLeft, rightBar));
-    assertEquals("equals didn't work", false, randomAccessLeft.equals(rightBar));
-    assertEquals("equivalent didn't work", false, AbstractVector.strictEquivalence(randomAccessLeft, rightBar));
+    assertFalse("equals didn't work", randomAccessLeft.equals(rightBar));
+    assertFalse("equivalent didn't work", AbstractVector.strictEquivalence(randomAccessLeft, rightBar));
 
     right.setQuick(2, 4);
-    assertEquals("equivalent didn't work", false, AbstractVector.equivalent(randomAccessLeft, right));
-    assertEquals("equals didn't work", false, randomAccessLeft.equals(right));
+    assertFalse("equivalent didn't work", AbstractVector.equivalent(randomAccessLeft, right));
+    assertFalse("equals didn't work", randomAccessLeft.equals(right));
     right = new DenseVector(4);
     right.setQuick(0, 1);
     right.setQuick(1, 2);
     right.setQuick(2, 3);
     right.setQuick(3, 3);
-    assertEquals("equivalent didn't work", false, AbstractVector.equivalent(randomAccessLeft, right));
-    assertEquals("equals didn't work", false, randomAccessLeft.equals(right));
+    assertFalse("equivalent didn't work", AbstractVector.equivalent(randomAccessLeft, right));
+    assertFalse("equals didn't work", randomAccessLeft.equals(right));
     randomAccessLeft = new RandomAccessSparseVector(2);
     randomAccessLeft.setQuick(0, 1);
     randomAccessLeft.setQuick(1, 2);
-    assertEquals("equivalent didn't work", false, AbstractVector.equivalent(randomAccessLeft, right));
-    assertEquals("equals didn't work", false, randomAccessLeft.equals(right));
+    assertFalse("equivalent didn't work", AbstractVector.equivalent(randomAccessLeft, right));
+    assertFalse("equals didn't work", randomAccessLeft.equals(right));
 
     DenseVector dense = new DenseVector(3);
     right = new DenseVector(3);
@@ -110,9 +105,8 @@
     dense.setQuick(0, 1);
     dense.setQuick(1, 2);
     dense.setQuick(2, 3);
-    assertEquals("equivalent didn't work", true,
-            AbstractVector.equivalent(dense, right));
-    assertEquals("equals didn't work", true, dense.equals(right));
+    assertTrue("equivalent didn't work", AbstractVector.equivalent(dense, right));
+    assertTrue("equals didn't work", dense.equals(right));
 
     RandomAccessSparseVector sparse = new RandomAccessSparseVector(3);
     randomAccessLeft = new RandomAccessSparseVector(3);
@@ -122,21 +116,18 @@
     randomAccessLeft.setQuick(0, 1);
     randomAccessLeft.setQuick(1, 2);
     randomAccessLeft.setQuick(2, 3);
-    assertEquals("equivalent didn't work", true,
-            AbstractVector.equivalent(sparse, randomAccessLeft));
-    assertEquals("equals didn't work", true, randomAccessLeft.equals(sparse));
+    assertTrue("equivalent didn't work", AbstractVector.equivalent(sparse, randomAccessLeft));
+    assertTrue("equals didn't work", randomAccessLeft.equals(sparse));
 
     VectorView v1 = new VectorView(randomAccessLeft, 0, 2);
     VectorView v2 = new VectorView(right, 0, 2);
-    assertEquals("equivalent didn't work", true,
-            AbstractVector.equivalent(v1, v2));
-    assertEquals("equals didn't work", true, v1.equals(v2));
+    assertTrue("equivalent didn't work", AbstractVector.equivalent(v1, v2));
+    assertTrue("equals didn't work", v1.equals(v2));
     sparse = new RandomAccessSparseVector(2);
     sparse.setQuick(0, 1);
     sparse.setQuick(1, 2);
-    assertEquals("equivalent didn't work", true,
-            AbstractVector.equivalent(v1, sparse));
-    assertEquals("equals didn't work", true, v1.equals(sparse));
+    assertTrue("equivalent didn't work", AbstractVector.equivalent(v1, sparse));
+    assertTrue("equals didn't work", v1.equals(sparse));
 
   }
 

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -28,12 +28,12 @@
 
 public abstract class SolverTest extends TestCase {
 
-  public SolverTest(String name) {
+  protected SolverTest(String name) {
     super(name);
   }
 
   public static void assertOrthonormal(Matrix eigens) {
-    assertOrthonormal(eigens, 1e-6);
+    assertOrthonormal(eigens, 1.0e-6);
   }
 
   public static void assertOrthonormal(Matrix currentEigens, double errorMargin) {
@@ -41,12 +41,14 @@
       Vector ei = currentEigens.getRow(i);
       for (int j = 0; j <= i; j++) {
         Vector ej = currentEigens.getRow(j);
-        if (ei.norm(2) == 0 || ej.norm(2) == 0) continue;
+        if (ei.norm(2) == 0 || ej.norm(2) == 0) {
+          continue;
+        }
         double dot = ei.dot(ej);
         if (i == j) {
-          assertTrue("not norm 1 : " + dot + " (eigen #" + i + ")", (Math.abs(1 - dot) < errorMargin));
+          assertTrue("not norm 1 : " + dot + " (eigen #" + i + ')', (Math.abs(1 - dot) < errorMargin));
         } else {
-          assertTrue("not orthogonal : " + dot + " (eigens " + i + ", " + j + ")", Math.abs(dot) < errorMargin);
+          assertTrue("not orthogonal : " + dot + " (eigens " + i + ", " + j + ')', Math.abs(dot) < errorMargin);
         }
       }
     }

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -19,14 +19,8 @@
 
 import org.apache.mahout.math.DenseMatrix;
 import org.apache.mahout.math.Matrix;
-import org.apache.mahout.math.Vector;
 
-import junit.framework.TestCase;
 import org.apache.mahout.math.decomposer.SolverTest;
-import org.apache.mahout.math.decomposer.lanczos.LanczosSolver;
-
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * This test is woefully inadequate, and also requires tons of memory, because it's part
@@ -56,22 +50,21 @@
                                 int maxNumPasses,
                                 int desiredRank,
                                 TrainingState state) throws Exception {
-    long time = 0;
     HebbianUpdater updater = new HebbianUpdater();
     SingularVectorVerifier verifier = new MultiThreadedEigenVerifier();
-    HebbianSolver solver;
-    solver = new HebbianSolver(updater,
-        verifier,
-        convergence,
-        maxNumPasses);
+    HebbianSolver solver = new HebbianSolver(updater,
+                                             verifier,
+                                             convergence,
+                                             maxNumPasses);
     long start = System.nanoTime();
     TrainingState finalState = solver.solve(corpus, desiredRank);
     assertNotNull(finalState);
     state.setCurrentEigens(finalState.getCurrentEigens());
     state.setCurrentEigenValues(finalState.getCurrentEigenValues());
+    long time = 0;
     time += System.nanoTime() - start;
     assertEquals(state.getCurrentEigens().numRows(), desiredRank);
-    return (long) (time / 1e6);
+    return (long) (time / 1000000);
   }
 
 
@@ -97,7 +90,7 @@
                                     state);
     eigens = state.getCurrentEigens();
     assertEigen(eigens, corpus, 0.05);
-    assertOrthonormal(eigens, 1e-6);
+    assertOrthonormal(eigens, 1.0e-6);
     System.out.println("Avg solving (Hebbian) time in ms: " + optimizedTime);
   }
 

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -26,14 +26,12 @@
 import java.util.Iterator;
 import java.util.regex.Pattern;
 
-
-/**
- *
- *
- **/
 public class VectorHelper {
   private static final Pattern TAB_PATTERN = Pattern.compile("\t");
 
+  private VectorHelper() {
+  }
+
 
   /**
    * Create a String from a vector that fills in the values with the appropriate value from a dictionary where each the ith entry is the term for the ith vector cell..
@@ -44,14 +42,14 @@
   public static String vectorToString(Vector vector, String [] dictionary){
     StringBuilder bldr = new StringBuilder(2048);
     String name = vector.getName();
-    if (name != null && name.equals("") == false) {
+    if (name != null && name.length() > 0) {
       bldr.append("Name: ").append(name).append(' ');
     }
     bldr.append("elts: {");
     Iterator<Vector.Element> iter = vector.iterateNonZero();
     boolean first = true;
     while (iter.hasNext()) {
-      if (first == true){
+      if (first){
         first = false;
       } else {
         bldr.append(", ");

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -74,7 +74,7 @@
     public final int outClusterDF;
     public double logLikelihoodRatio;
 
-    public TermInfoClusterInOut(String term, int inClusterDF, int outClusterDF) {
+    TermInfoClusterInOut(String term, int inClusterDF, int outClusterDF) {
       this.term = term;
       this.inClusterDF = inClusterDF;
       this.outClusterDF = outClusterDF;
@@ -132,12 +132,12 @@
       writer = new OutputStreamWriter(System.out);
     }
 
-    for (String clusterID : clusterIdToPoints.keySet()) {
-      List<String> ids = clusterIdToPoints.get(clusterID);
-      List<TermInfoClusterInOut> termInfos = getClusterLabels(clusterID, ids);
+    for (Map.Entry<String, List<String>> stringListEntry : clusterIdToPoints.entrySet()) {
+      List<String> ids = stringListEntry.getValue();
+      List<TermInfoClusterInOut> termInfos = getClusterLabels(stringListEntry.getKey(), ids);
       if (termInfos != null) {
         writer.write('\n');
-        writer.write("Top labels for Cluster " + clusterID + " containing " + ids.size() + " vectors");
+        writer.write("Top labels for Cluster " + stringListEntry.getKey() + " containing " + ids.size() + " vectors");
         writer.write('\n');
         writer.write("Term \t\t LLR \t\t In-ClusterDF \t\t Out-ClusterDF ");
         writer.write('\n');
@@ -246,7 +246,8 @@
   }
 
 
-  private OpenBitSet getClusterDocBitset(IndexReader reader, Set<String> idSet, String idField) throws IOException {
+  private static OpenBitSet getClusterDocBitset(IndexReader reader, Set<String> idSet, String idField)
+      throws IOException {
     int numDocs = reader.numDocs();
 
     OpenBitSet bitset = new OpenBitSet(numDocs);
@@ -269,7 +270,7 @@
     return bitset;
   }
 
-  private double scoreDocumentFrequencies(int inDF, int outDF, int clusterSize, int corpusSize) {
+  private static double scoreDocumentFrequencies(int inDF, int outDF, int clusterSize, int corpusSize) {
     int k12 = clusterSize - inDF;
     int k22 = corpusSize - clusterSize - outDF;
 
@@ -351,11 +352,11 @@
 
 
       String idField = null;
-      String output = null;
 
       if (cmdLine.hasOption(idFieldOpt)) {
         idField = cmdLine.getValue(idFieldOpt).toString();
       }
+      String output = null;
       if (cmdLine.hasOption(outputOpt)) {
         output = cmdLine.getValue(outputOpt).toString();
       }

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/Driver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/Driver.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/Driver.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/Driver.java Tue Jan 26 03:55:27 2010
@@ -33,7 +33,6 @@
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
-import org.apache.mahout.math.RandomAccessSparseVector;
 import org.apache.mahout.common.CommandLineUtil;
 import org.apache.mahout.math.VectorWritable;
 import org.apache.mahout.utils.vectors.TF;

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=903071&r1=903070&r2=903071&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 Tue Jan 26 03:55:27 2010
@@ -175,8 +175,7 @@
         fs
             .globStatus(new Path(wordCountPath.toString()
                 + OUTPUT_FILES_PATTERN));
-    
-    long i = 0;
+
     long chunkSizeLimit = chunkSizeInMegabytes * 1024 * 1024;
     int chunkIndex = 0;
     Path chunkPath = getPath(dictionaryPathBase + DICTIONARY_FILE, chunkIndex);
@@ -191,7 +190,8 @@
             + FREQUENCY_FILE, chunkIndex), Text.class, LongWritable.class);
     
     long currentChunkSize = 0;
-    
+
+    long i = 0;
     for (FileStatus fileStatus : outputFiles) {
       Path path = fileStatus.getPath();
       SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/PartialVectorGenerator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/PartialVectorGenerator.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/PartialVectorGenerator.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/PartialVectorGenerator.java Tue Jan 26 03:55:27 2010
@@ -46,11 +46,10 @@
     Reducer<Text,Text,Text,VectorWritable> {
   private Analyzer analyzer;
   private final Map<String,int[]> dictionary = new HashMap<String,int[]>();
-  private FileSystem fs; // local filesystem
-  private URI[] localFiles; // local filenames from the distributed cache
-  
+
   private final VectorWritable vectorWritable = new VectorWritable();
   
+  @Override
   public void reduce(Text key,
                      Iterator<Text> values,
                      OutputCollector<Text,VectorWritable> output,
@@ -81,14 +80,14 @@
   public void configure(JobConf job) {
     super.configure(job);
     try {
-      
-      localFiles = DistributedCache.getCacheFiles(job);
+
+      URI[] localFiles = DistributedCache.getCacheFiles(job);
       if (localFiles == null || localFiles.length < 1) {
         throw new IllegalArgumentException(
             "missing paths from the DistributedCache");
       }
       Path dictionaryFile = new Path(localFiles[0].getPath());
-      fs = dictionaryFile.getFileSystem(job);
+      FileSystem fs = dictionaryFile.getFileSystem(job);
       SequenceFile.Reader reader =
           new SequenceFile.Reader(fs, dictionaryFile, job);
       Text key = new Text();

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java?rev=903071&r1=903070&r2=903071&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java (original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java Tue Jan 26 03:55:27 2010
@@ -29,29 +29,27 @@
 import org.apache.mahout.utils.vectors.lucene.LuceneIterable;
 import org.apache.mahout.utils.vectors.lucene.TFDFMapper;
 import org.apache.mahout.utils.vectors.lucene.VectorMapper;
-import org.junit.After;
 import org.junit.Before;
 
 
 public class TestL1ModelClustering extends MahoutTestCase {
 
   @SuppressWarnings("unchecked")
-  private class MapElement implements Comparable {
+  private class MapElement implements Comparable<MapElement> {
 
-    public MapElement(double pdf, String doc) {
+    MapElement(double pdf, String doc) {
       super();
       this.pdf = pdf;
       this.doc = doc;
     }
 
-    Double pdf;
+    private final Double pdf;
 
-    String doc;
+    private final String doc;
 
     @Override
     // reverse compare to sort in reverse order
-    public int compareTo(Object o) {
-      MapElement e = (MapElement) o;
+    public int compareTo(MapElement e) {
       if (e.pdf > pdf)
         return 1;
       else if (e.pdf < pdf)
@@ -61,7 +59,7 @@
     }
 
     public String toString() {
-      return pdf.toString() + " " + doc.toString();
+      return pdf.toString() + ' ' + doc.toString();
     }
 
   }
@@ -74,8 +72,6 @@
 
   private List<VectorWritable> sampleData;
 
-  private RAMDirectory directory;
-
   private static final String[] DOCS2 = { "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.",
@@ -85,15 +81,16 @@
       "The robber wore a black fleece jacket and a baseball cap.", "The robber wore a red fleece jacket and a baseball cap.",
       "The robber wore a white fleece jacket and a baseball cap.", "The English Springer Spaniel is the best of all dogs." };
 
+  @Override
   @Before
-  protected void setUp() throws Exception {
+  public void setUp() throws Exception {
     super.setUp();
     RandomUtils.useTestSeed();
   }
 
-  private void getSampleData(String[] docs2) throws CorruptIndexException, LockObtainFailedException, IOException {
+  private void getSampleData(String[] docs2) throws IOException {
     sampleData = new ArrayList<VectorWritable>();
-    directory = new RAMDirectory();
+    RAMDirectory directory = new RAMDirectory();
     IndexWriter writer = new IndexWriter(directory, new StandardAnalyzer(Version.LUCENE_CURRENT), true,
         IndexWriter.MaxFieldLength.UNLIMITED);
     for (int i = 0; i < docs2.length; i++) {
@@ -120,11 +117,7 @@
     }
   }
 
-  @After
-  protected void tearDown() throws Exception {
-  }
-
-  private String formatVector(Vector v) {
+  private static String formatVector(Vector v) {
     StringBuilder buf = new StringBuilder();
     int nzero = 0;
     Iterator<Element> iterateNonZero = v.iterateNonZero();
@@ -132,26 +125,24 @@
       iterateNonZero.next();
       nzero++;
     }
-    buf.append("(").append(nzero);
+    buf.append('(').append(nzero);
     buf.append("nz) [");
+    // handle sparse Vectors gracefully, suppressing zero values
     int nextIx = 0;
-    if (v != null) {
-      // handle sparse Vectors gracefully, suppressing zero values
-      for (int i = 0; i < v.size(); i++) {
-        double elem = v.get(i);
-        if (elem == 0.0)
-          continue;
-        if (i > nextIx)
-          buf.append("..{").append(i).append("}=");
-        buf.append(String.format("%.2f", elem)).append(", ");
-        nextIx = i + 1;
-      }
+    for (int i = 0; i < v.size(); i++) {
+      double elem = v.get(i);
+      if (elem == 0.0)
+        continue;
+      if (i > nextIx)
+        buf.append("..{").append(i).append("}=");
+      buf.append(String.format("%.2f", elem)).append(", ");
+      nextIx = i + 1;
     }
-    buf.append("]");
+    buf.append(']');
     return buf.toString();
   }
 
-  private void printSamples(List<Model<VectorWritable>[]> result, int significant) {
+  private static void printSamples(List<Model<VectorWritable>[]> result, int significant) {
     int row = 0;
     for (Model<VectorWritable>[] r : result) {
       int sig = 0;