mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r919495 - in /lucene/mahout/trunk: collections/src/main/java/org/apache/mahout/math/list/ collections/src/test/java/org/apache/mahout/math/ collections/src/test/java/org/apache/mahout/math/map/ core/src/main/java/org/apache/mahout/classifie...
Date Fri, 05 Mar 2010 17:01:36 GMT
Author: srowen
Date: Fri Mar  5 17:01:35 2010
New Revision: 919495

URL: http://svn.apache.org/viewvc?rev=919495&view=rev
Log:
More style bits, I think

Modified:
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/SortingTest.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/classifier/bayes/algorithm/BayesAlgorithm.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/CBayesAlgorithm.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/kmeans/TestKmeansClustering.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/kmeans/DisplayKMeans.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputMapper.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.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/function/Functions.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.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/DoubleQuantileEstimator.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Formatter.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/CholeskyDecomposition.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Diagonal.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/EigenvalueDecomposition.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/QRDecomposition.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SeqBlas.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/TestDenseVector.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestSparseVector.java
    lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestVectorView.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/benchmark/VectorBenchmarks.java
    lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.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/LLRReducer.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/utils/nlp/collocations/llr/CollocMapperTest.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
    lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java

Modified: lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java (original)
+++ lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java Fri Mar  5 17:01:35 2010
@@ -29,7 +29,7 @@
 import org.apache.mahout.math.function.ObjectProcedure;
 
 import java.util.Collection;
-import java.util.Date;
+
 /**
  Resizable list holding <code>${valueType}</code> elements; implemented with arrays.
 */

Modified: lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/SortingTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/SortingTest.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/SortingTest.java (original)
+++ lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/SortingTest.java Fri Mar  5 17:01:35 2010
@@ -158,43 +158,43 @@
     assertEquals(-4, x);
     
     int[] ints = {-5, -2, 0, 100, 103};
-    x = Sorting.binarySearchFromTo(ints, (int) -6, 0, 4);
+    x = Sorting.binarySearchFromTo(ints, -6, 0, 4);
     assertEquals(-1, x);
-    x = Sorting.binarySearchFromTo(ints, (int) 0, 0, 4);
+    x = Sorting.binarySearchFromTo(ints, 0, 0, 4);
     assertEquals(2, x);
-    x = Sorting.binarySearchFromTo(ints, (int) 5, 0, 4);
+    x = Sorting.binarySearchFromTo(ints, 5, 0, 4);
     assertEquals(-4, x);
-    x = Sorting.binarySearchFromTo(ints, (int) 0, 3, 4);
+    x = Sorting.binarySearchFromTo(ints, 0, 3, 4);
     assertEquals(-4, x);
     
     long[] longs = {-5, -2, 0, 100, 103};
-    x = Sorting.binarySearchFromTo(longs, (long) -6, 0, 4);
+    x = Sorting.binarySearchFromTo(longs, -6L, 0, 4);
     assertEquals(-1, x);
-    x = Sorting.binarySearchFromTo(longs, (long) 0, 0, 4);
+    x = Sorting.binarySearchFromTo(longs, 0L, 0, 4);
     assertEquals(2, x);
-    x = Sorting.binarySearchFromTo(longs, (long) 5, 0, 4);
+    x = Sorting.binarySearchFromTo(longs, 5L, 0, 4);
     assertEquals(-4, x);
-    x = Sorting.binarySearchFromTo(longs, (long) 0, 3, 4);
+    x = Sorting.binarySearchFromTo(longs, 0L, 3, 4);
     assertEquals(-4, x);
     
     float[] floats = {-5, -2, 0, 100, 103};
-    x = Sorting.binarySearchFromTo(floats, (float) -6, 0, 4);
+    x = Sorting.binarySearchFromTo(floats, -6.0f, 0, 4);
     assertEquals(-1, x);
-    x = Sorting.binarySearchFromTo(floats, (float) 0, 0, 4);
+    x = Sorting.binarySearchFromTo(floats, 0.0f, 0, 4);
     assertEquals(2, x);
-    x = Sorting.binarySearchFromTo(floats, (float) 5, 0, 4);
+    x = Sorting.binarySearchFromTo(floats, 5.0f, 0, 4);
     assertEquals(-4, x);
-    x = Sorting.binarySearchFromTo(floats, (float) 0, 3, 4);
+    x = Sorting.binarySearchFromTo(floats, 0.0f, 3, 4);
     assertEquals(-4, x);
     
     double[] doubles = {-5, -2, 0, 100, 103};
-    x = Sorting.binarySearchFromTo(doubles, (double) -6, 0, 4);
+    x = Sorting.binarySearchFromTo(doubles, -6.0, 0, 4);
     assertEquals(-1, x);
-    x = Sorting.binarySearchFromTo(doubles, (double) 0, 0, 4);
+    x = Sorting.binarySearchFromTo(doubles, 0.0, 0, 4);
     assertEquals(2, x);
-    x = Sorting.binarySearchFromTo(doubles, (double) 5, 0, 4);
+    x = Sorting.binarySearchFromTo(doubles, 5.0, 0, 4);
     assertEquals(-4, x);
-    x = Sorting.binarySearchFromTo(doubles, (double) 0, 3, 4);
+    x = Sorting.binarySearchFromTo(doubles, 0.0, 3, 4);
     assertEquals(-4, x);
   }
   

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -135,8 +135,8 @@
   }
   
   private static class Pair implements Comparable<Pair> {
-    final String k;
-    final String v;
+    private final String k;
+    private final String v;
     
     Pair(String k, String v) {
       this.k = k;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/BayesAlgorithm.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/BayesAlgorithm.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/BayesAlgorithm.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/BayesAlgorithm.java Fri Mar  5 17:01:35 2010
@@ -126,7 +126,7 @@
         try {
           result.add(frequency * featureWeight(datastore, label, word));
         } catch (InvalidDatastoreException e) {
-          throw new RuntimeException(e);
+          throw new IllegalStateException(e);
         }
         return true;
       }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/CBayesAlgorithm.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/CBayesAlgorithm.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/CBayesAlgorithm.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/algorithm/CBayesAlgorithm.java Fri Mar  5 17:01:35 2010
@@ -135,7 +135,7 @@
         try {
           result.add(frequency * featureWeight(datastore, label, word));
         } catch (InvalidDatastoreException e) {
-          throw new RuntimeException(e);
+          throw new IllegalStateException(e);
         }
         return true;
       }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/cbayes/CBayesThetaNormalizerMapper.java Fri Mar  5 17:01:35 2010
@@ -78,7 +78,7 @@
           try {
             output.collect(normalizerTuple, new DoubleWritable(weight));
           } catch (IOException e) {
-            throw new RuntimeException(e);
+            throw new IllegalStateException(e);
           } // output Sigma_j
           return true;
         }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureMapper.java Fri Mar  5 17:01:35 2010
@@ -123,7 +123,7 @@
           DoubleWritable f = new DoubleWritable(Math.log(1.0 + dKJ) / lengthNormalisation);
           output.collect(tuple, f);
         } catch (IOException e) {
-          throw new RuntimeException(e);
+          throw new IllegalStateException(e);
         }
         return true;
       }
@@ -146,7 +146,7 @@
           tokenCountTuple.add(token);
           output.collect(tokenCountTuple, ONE);
         } catch (IOException e) {
-          throw new RuntimeException(e);
+          throw new IllegalStateException(e);
         }
         return true;
       }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java Fri Mar  5 17:01:35 2010
@@ -157,7 +157,7 @@
       if (cmdLine.hasOption(numReduceTasksOpt)) {
         numReduceTasks = Integer.parseInt(cmdLine.getValue(numReduceTasksOpt).toString());
       }
-      if (cmdLine.hasOption(overwriteOutput) == true) {
+      if (cmdLine.hasOption(overwriteOutput)) {
         HadoopUtil.overwriteOutput(output);
       }
       if (cmdLine.hasOption(kOpt)) {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java Fri Mar  5 17:01:35 2010
@@ -70,7 +70,7 @@
       Path inputPathPattern;
       Path inputPath = new Path(input);
       
-      if (fs.getFileStatus(inputPath).isDir() == true) {
+      if (fs.getFileStatus(inputPath).isDir()) {
         inputPathPattern = new Path(inputPath.toString() + "/*");
       } else {
         inputPathPattern = inputPath;
@@ -84,7 +84,7 @@
       int nextClusterId = 0;
       
       for (FileStatus fileStatus : inputFiles) {
-        if (fileStatus.isDir() == true) {
+        if (fileStatus.isDir()) {
           continue; // select only the top level files
         }
         SequenceFile.Reader reader = new SequenceFile.Reader(fs, fileStatus.getPath(), conf);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/driver/MahoutDriver.java Fri Mar  5 17:01:35 2010
@@ -81,10 +81,13 @@
  *   {"--output", "/tmp/vectorOut", "-s", "/my/otherVector/sequenceFile"}
  */
 public class MahoutDriver {
+
   private static final Logger log = LoggerFactory.getLogger(MahoutDriver.class);
 
-  public static void main(String[] args) throws Exception {
-    int exitCode = -1;
+  private MahoutDriver() {
+  }
+
+  public static void main(String[] args) throws Throwable {
     try {
       ProgramDriver programDriver = new ProgramDriver();
       Properties mainClasses = new Properties();
@@ -97,10 +100,10 @@
       boolean foundShortName = false;
       for(Object key :  mainClasses.keySet()) {
         String keyString = (String) key;
-        if(args.length > 0 && shortName((String)mainClasses.get(keyString)).equals(args[0])) {
+        if(args.length > 0 && shortName(mainClasses.getProperty(keyString)).equals(args[0])) {
           foundShortName = true;
         }
-        addClass(programDriver, keyString, (String)mainClasses.get(keyString));
+        addClass(programDriver, keyString, mainClasses.getProperty(keyString));
       }
       if(args.length < 1 || args[0] == null || args[0].equals("-h") || args[0].equals("--help")) {
         programDriver.driver(args);
@@ -145,12 +148,12 @@
         }
         argMap.put(arg, argValues.toArray(new String[argValues.size()]));
       }
-      for(Object key : mainProps.keySet()) {
-        String[] argNamePair = ((String)key).split("\\|");
-        String shortArg = "-" + argNamePair[0].trim();
+      for (String key : mainProps.stringPropertyNames()) {
+        String[] argNamePair = key.split("\\|");
+        String shortArg = '-' + argNamePair[0].trim();
         String longArg = argNamePair.length < 2 ? null : "--" + argNamePair[1].trim();
         if(!argMap.containsKey(shortArg) && (longArg == null || !argMap.containsKey(longArg))) {
-          argMap.put(longArg, new String[] { ((String)mainProps.get(key)) } );
+          argMap.put(longArg, new String[] { mainProps.getProperty(key) } );
         }
       }
       List<String> argsList = new ArrayList<String>();
@@ -158,24 +161,19 @@
       for(String arg : argMap.keySet()) {
         if(arg.startsWith("-D")) { // arg is -Dkey - if value for this !isEmpty(), then arg -> -Dkey + "=" + value
           if(argMap.get(arg).length > 0 && !argMap.get(arg)[0].trim().isEmpty()) {
-            arg += "=" + argMap.get(arg)[0].trim();
+            arg += '=' + argMap.get(arg)[0].trim();
           }
         }
         argsList.add(arg);
         if(!arg.startsWith("-D")) {
-          for(String argValue : argMap.get(arg)) {
-            argsList.add(argValue);
-          }
+          argsList.addAll(Arrays.asList(argMap.get(arg)));
         }
       }
       programDriver.driver(argsList.toArray(new String[argsList.size()]));
-      exitCode = 0;
     } catch (Throwable e) {
-      e.printStackTrace();
-      log.error("MahoutDriver failed with args: " + Arrays.toString(args) + "\n" + e.getMessage());
-      exitCode = -1;
+      log.error("MahoutDriver failed with args: " + Arrays.toString(args) + '\n' + e.getMessage());
+      throw e;
     }
-    System.exit(exitCode);
   }
 
   private static String[] shift(String[] args) {
@@ -185,18 +183,18 @@
   }
 
   private static String shortName(String valueString) {
-    if(valueString.indexOf(":") < 0) {
-      return valueString;
+    if (valueString.contains(":")) {
+      return valueString.substring(0, valueString.indexOf(':')).trim();
     } else {
-      return valueString.substring(0, valueString.indexOf(":")).trim();
+      return valueString;
     }
   }
 
   private static String desc(String valueString) {
-    if(valueString.indexOf(":") < 0) {
-      return valueString;
+    if (valueString.contains(":")) {
+      return valueString.substring(valueString.indexOf(':')).trim();
     } else {
-      return valueString.substring(valueString.indexOf(":")).trim();
+      return valueString;
     }
   }
 
@@ -204,8 +202,10 @@
     try {
       Class<?> clazz = Class.forName(classString);
       driver.addClass(shortName(descString), clazz, desc(descString));
-    } catch (Throwable e) {
-      log.warn("Unable to add class: " + classString + "\n" + e.getMessage());
+    } catch (ClassNotFoundException e) {
+      log.warn("Unable to add class: " + classString, e);
+    } catch (Throwable t) {
+      log.warn("Unable to add class: " + classString, t);
     }
   }
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java Fri Mar  5 17:01:35 2010
@@ -69,7 +69,7 @@
       rowPath= FileSystem.get(conf).makeQualified(new Path(inputPathString));
       outputTmpBasePath = FileSystem.get(conf).makeQualified(new Path(outputTmpPathString));
     } catch(IOException ioe) {
-      throw new RuntimeException(ioe);
+      throw new IllegalStateException(ioe);
     }
   }
 
@@ -98,7 +98,7 @@
       SequenceFile.Reader reader = new SequenceFile.Reader(fs, rowPath, conf);
       return new DistributedMatrixIterator(reader);
     } catch (IOException ioe) {
-      throw new RuntimeException(ioe);
+      throw new IllegalStateException(ioe);
     }
   }
 
@@ -133,7 +133,7 @@
       JobClient.runJob(conf);
       return TimesSquaredJob.retrieveTimesSquaredOutputVector(conf);
     } catch(IOException ioe) {
-      throw new RuntimeException(ioe);
+      throw new IllegalStateException(ioe);
     }
   }
   
@@ -161,7 +161,7 @@
           hasBuffered = true;
         }
       } catch (IOException ioe) {
-        throw new RuntimeException(ioe);
+        throw new IllegalStateException(ioe);
       } finally {
         if(!hasNext) {
           try { reader.close(); } catch (IOException ioe) {}

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java Fri Mar  5 17:01:35 2010
@@ -74,7 +74,7 @@
                                                   Class<? extends TimesSquaredMapper> mapClass,
                                                   Class<? extends VectorSummingReducer> redClass) throws IOException {
     JobConf conf = new JobConf(TimesSquaredJob.class);
-    conf.setJobName("TimesSquaredJob: " + matrixInputPath + " timesSquared(" + v.getName() + ")");
+    conf.setJobName("TimesSquaredJob: " + matrixInputPath + " timesSquared(" + v.getName() + ')');
     FileSystem fs = FileSystem.get(conf);
     matrixInputPath = fs.makeQualified(matrixInputPath);
     outputVectorPathBase = fs.makeQualified(outputVectorPathBase);
@@ -107,23 +107,18 @@
     return conf;
   }
 
-  public static Vector retrieveTimesSquaredOutputVector(JobConf conf) {
-    try {
-      Path outputPath = FileOutputFormat.getOutputPath(conf);
-      FileSystem fs = FileSystem.get(conf);
-      Path outputFile = new Path(outputPath, "part-00000");
-      SequenceFile.Reader reader = new SequenceFile.Reader(fs, outputFile, conf);
-      NullWritable n = NullWritable.get();
-      VectorWritable v = new VectorWritable();
-      reader.next(n,v);
-      Vector vector = v.get();
-      reader.close();
-      fs.deleteOnExit(outputFile);
-      return vector;
-    } catch (IOException ioe) {
-      log.error("Unable to retrieve vector!");
-      throw new RuntimeException(ioe);
-    }
+  public static Vector retrieveTimesSquaredOutputVector(JobConf conf) throws IOException {
+    Path outputPath = FileOutputFormat.getOutputPath(conf);
+    FileSystem fs = FileSystem.get(conf);
+    Path outputFile = new Path(outputPath, "part-00000");
+    SequenceFile.Reader reader = new SequenceFile.Reader(fs, outputFile, conf);
+    NullWritable n = NullWritable.get();
+    VectorWritable v = new VectorWritable();
+    reader.next(n,v);
+    Vector vector = v.get();
+    reader.close();
+    fs.deleteOnExit(outputFile);
+    return vector;
   }
 
   public static class TimesSquaredMapper extends MapReduceBase
@@ -159,7 +154,7 @@
                      ? new RandomAccessSparseVector(inputVector.size(), 10)
                      : new DenseVector(inputVector.size());
       } catch (IOException ioe) {
-        throw new RuntimeException(ioe);
+        throw new IllegalStateException(ioe);
       }
     }
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/kmeans/TestKmeansClustering.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/kmeans/TestKmeansClustering.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/kmeans/TestKmeansClustering.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/kmeans/TestKmeansClustering.java Fri Mar  5 17:01:35 2010
@@ -132,7 +132,7 @@
     for (Vector p : points) {
       c.addPoint(p);
       if (c.getNumPoints() > 1) {
-        assertEquals(c.getStd() > 0.0, true);
+        assertTrue(c.getStd() > 0.0);
       }
     }
   }

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -42,9 +42,7 @@
 public class TestMeanShift extends MahoutTestCase {
   
   private Vector[] raw = null;
-  
-  private FileSystem fs;
-  
+
   private Configuration conf;
   
   // DistanceMeasure manhattanDistanceMeasure = new ManhattanDistanceMeasure();
@@ -109,7 +107,6 @@
   protected void setUp() throws Exception {
     super.setUp();
     conf = new Configuration();
-    fs = FileSystem.get(conf);
     rmr("output");
     rmr("testdata");
     raw = new Vector[100];

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/kmeans/DisplayKMeans.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/kmeans/DisplayKMeans.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/kmeans/DisplayKMeans.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/kmeans/DisplayKMeans.java Fri Mar  5 17:01:35 2010
@@ -32,9 +32,6 @@
 import org.apache.mahout.math.VectorWritable;
 
 class DisplayKMeans extends DisplayDirichlet {
-  private static final double t1 = 3.0;
-  
-  private static final double t2 = 1.5;
   
   private static List<List<Cluster>> clusters;
   
@@ -55,7 +52,7 @@
       for (Cluster cluster : cls) {
         // if (true || cluster.getNumPoints() > sampleData.size() * 0.05) {
         dv.assign(cluster.getStd() * 3);
-        System.out.println(cluster.getCenter().asFormatString() + " " + dv.asFormatString());
+        System.out.println(cluster.getCenter().asFormatString() + ' ' + dv.asFormatString());
         DisplayDirichlet.plotEllipse(g2, cluster.getCenter(), dv);
         // }
       }

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputMapper.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputMapper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputMapper.java Fri Mar  5 17:01:35 2010
@@ -25,7 +25,6 @@
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.hadoop.mapred.Reporter;
 import org.apache.mahout.clustering.meanshift.MeanShiftCanopy;
-import org.apache.mahout.math.Vector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java Fri Mar  5 17:01:35 2010
@@ -250,7 +250,7 @@
   }
 
   private static class AddToVector implements IntDoubleProcedure {
-    final Vector v;
+    private final Vector v;
 
     private AddToVector(Vector v) {
       this.v = v;

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java Fri Mar  5 17:01:35 2010
@@ -232,8 +232,10 @@
   }
 
   private static final class DenseElement extends AbstractElement {
-    int index;
-    SequentialAccessSparseVector v;
+
+    private int index;
+    private final SequentialAccessSparseVector v;
+
     DenseElement(int ind, SequentialAccessSparseVector v) {
       super(ind, v);
       this.v = v;
@@ -262,7 +264,8 @@
 
   private static final class SparseElement extends AbstractElement {
 
-    SequentialAccessSparseVector v;
+    private final SequentialAccessSparseVector v;
+
     SparseElement(int ind, SequentialAccessSparseVector v) {
       super(ind, v);
       this.v = v;

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -184,11 +184,11 @@
 
   protected Vector getInitialVector(VectorIterable corpus) {
     Vector v = null;
-    Iterator<MatrixSlice> it = corpus.iterator();
-    while(it.hasNext()) {
-      MatrixSlice slice = it.next();
+    for (MatrixSlice slice : corpus) {
       Vector vector;
-      if(slice == null || (vector = slice.vector()) == null || vector.getLengthSquared() == 0) continue;
+      if (slice == null || (vector = slice.vector()) == null || vector.getLengthSquared() == 0) {
+        continue;
+      }
       scaleFactor += vector.getLengthSquared();
       if (v == null) {
         v = new DenseVector(vector.size()).plus(vector);

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java Fri Mar  5 17:01:35 2010
@@ -402,7 +402,7 @@
   /** Function that returns <tt>a + b</tt>. */
   public static final BinaryFunction plus = new BinaryFunction() {
     
-    public final double apply(double a, double b) {
+    public double apply(double a, double b) {
       return a + b;
     }
   };

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/Fun.java Fri Mar  5 17:01:35 2010
@@ -230,13 +230,7 @@
       double prod = 0.0;
       double diff = 8.0;
       double value = 1.0;
-      while (true) { //while (!NULL) {
-        if ((factorial(i) * Math.pow((8.0 * beta), i)) > 1.0e250) {
-          break;
-        }
-        if (i > 10) {
-          break;
-        }
+      while (factorial(i) * Math.pow(8.0 * beta, i) <= 1.0e250 && i <= 10) {
         if (i == 1) {
           prod = my - 1.0;
         } else {

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -190,7 +190,7 @@
     }
 
     //do the main work: determine values at given positions in sorted sequence
-    double[] outputValues = this.getValuesAtPositions(buffers, triggerPositions);
+    double[] outputValues = getValuesAtPositions(buffers, triggerPositions);
 
     //mark all full buffers as empty, except the first, which will contain the output
     for (int b = 1; b < buffers.length; b++) {
@@ -392,7 +392,7 @@
   /** Returns the number of elements in all buffers. */
   public long totalSize() {
     DoubleBuffer[] fullBuffers = _getFullOrPartialBuffers();
-    long totalSize = 0;
+    long totalSize = 0L;
     for (int i = fullBuffers.length; --i >= 0;) {
       totalSize += fullBuffers[i].size() * fullBuffers[i].weight();
     }

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleQuantileEstimator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleQuantileEstimator.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleQuantileEstimator.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/stat/quantile/DoubleQuantileEstimator.java Fri Mar  5 17:01:35 2010
@@ -227,7 +227,7 @@
     //double[] quantileElements = new double[phis.size()];
 
     //do the main work: determine values at given positions in sorted sequence
-    return new DoubleArrayList(bufferSet.getValuesAtPositions(fullBuffers, triggerPositions));
+    return new DoubleArrayList(DoubleBufferSet.getValuesAtPositions(fullBuffers, triggerPositions));
   }
 
   /** Not yet commented. */

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Formatter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Formatter.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Formatter.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/doublealgo/Formatter.java Fri Mar  5 17:01:35 2010
@@ -297,7 +297,7 @@
   /** Converts a given cell to a String; no alignment considered. */
   @Override
   protected String form(AbstractMatrix1D matrix, int index, Former formatter) {
-    return this.form((DoubleMatrix1D) matrix, index, formatter);
+    return form((DoubleMatrix1D) matrix, index, formatter);
   }
 
   /** Returns a string representations of all cells; no alignment considered. */

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -136,7 +136,7 @@
    * @return a new independent matrix; inverse(matrix) if the matrix is square, pseudoinverse otherwise.
    */
   public DoubleMatrix2D inverse(DoubleMatrix2D A) {
-    if (property.isSquare(A) && property.isDiagonal(A)) {
+    if (Property.isSquare(A) && property.isDiagonal(A)) {
       DoubleMatrix2D inv = A.copy();
       boolean isNonSingular = Diagonal.inverse(inv);
       if (!isNonSingular) {
@@ -433,7 +433,7 @@
     // Was: for parallel matrix mult; if not initialized defaults to sequential blas
     Blas blas = SeqBlas.seqBlas;
    
-    Property.DEFAULT.checkSquare(A);
+    Property.checkSquare(A);
     if (p < 0) {
       A = inverse(A);
       p = -p;

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/CholeskyDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/CholeskyDecomposition.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/CholeskyDecomposition.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/CholeskyDecomposition.java Fri Mar  5 17:01:35 2010
@@ -36,7 +36,7 @@
    * @throws IllegalArgumentException if <tt>A</tt> is not square.
    */
   public CholeskyDecomposition(DoubleMatrix2D A) {
-    Property.DEFAULT.checkSquare(A);
+    Property.checkSquare(A);
     // Initialize.
     //double[][] A = Arg.getArray();
 

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Diagonal.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Diagonal.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Diagonal.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Diagonal.java Fri Mar  5 17:01:35 2010
@@ -23,7 +23,7 @@
    * @throws IllegalArgumentException if <tt>x.size() != y.size()</tt>.
    */
   public static boolean inverse(DoubleMatrix2D A) {
-    Property.DEFAULT.checkSquare(A);
+    Property.checkSquare(A);
     boolean isNonSingular = true;
     for (int i = A.rows(); --i >= 0;) {
       double v = A.getQuick(i, i);

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/EigenvalueDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/EigenvalueDecomposition.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/EigenvalueDecomposition.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/EigenvalueDecomposition.java Fri Mar  5 17:01:35 2010
@@ -13,6 +13,8 @@
 import org.apache.mahout.math.matrix.DoubleMatrix1D;
 import org.apache.mahout.math.matrix.DoubleMatrix2D;
 
+import static org.apache.mahout.math.matrix.linalg.Property.*;
+
 /** @deprecated until unit tests are in place.  Until this time, this class/interface is unsupported. */
 @Deprecated
 public class EigenvalueDecomposition implements java.io.Serializable {
@@ -45,14 +47,14 @@
    * @throws IllegalArgumentException if <tt>A</tt> is not square.
    */
   public EigenvalueDecomposition(DoubleMatrix2D A) {
-    Property.DEFAULT.checkSquare(A);
+    checkSquare(A);
 
     n = A.columns();
     V = new double[n][n];
     d = new double[n];
     e = new double[n];
 
-    boolean issymmetric = Property.DEFAULT.isSymmetric(A);
+    boolean issymmetric = DEFAULT.isSymmetric(A);
 
     if (issymmetric) {
       for (int i = 0; i < n; i++) {

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -381,7 +381,7 @@
     if (this.workDouble == null || this.workDouble.length < m) {
       this.workDouble = new double[m];
     }
-    algebra.permute(B, this.piv, this.workDouble);
+    Algebra.permute(B, this.piv, this.workDouble);
 
     if (m * n == 0) {
       return;
@@ -445,7 +445,7 @@
       this.work1 = new int[m];
     }
     //if (this.work2 == null || this.work2.length < m) this.work2 = new int[m];
-    algebra.permuteRows(B, this.piv, this.work1);
+    Algebra.permuteRows(B, this.piv, this.work1);
 
     if (m * n == 0) {
       return;
@@ -558,7 +558,7 @@
       this.work1 = new int[m];
     }
     //if (this.work2 == null || this.work2.length < m) this.work2 = new int[m];
-    algebra.permuteRows(B, this.piv, this.work1);
+    Algebra.permuteRows(B, this.piv, this.work1);
 
     // Solve L*Y = B(piv,:) --> Y (Y is modified B)
     for (int k = 0; k < n; k++) {

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -496,7 +496,7 @@
 
   /** A matrix <tt>A</tt> is <i>singular</i> if it has no inverse, that is, iff <tt>det(A)==0</tt>. */
   public boolean isSingular(DoubleMatrix2D A) {
-    return !(Math.abs(Algebra.DEFAULT.det(A)) >= tolerance());
+    return Math.abs(Algebra.det(A)) < tolerance();
   }
 
   /**

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/QRDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/QRDecomposition.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/QRDecomposition.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/QRDecomposition.java Fri Mar  5 17:01:35 2010
@@ -50,7 +50,7 @@
    */
 
   public QRDecomposition(DoubleMatrix2D A) {
-    Property.DEFAULT.checkRectangular(A);
+    Property.checkRectangular(A);
 
     // Initialize.
     QR = A.copy();
@@ -126,7 +126,7 @@
    * @return A lower trapezoidal matrix whose columns define the householder reflections.
    */
   public DoubleMatrix2D getH() {
-    return Algebra.DEFAULT.trapezoidalLower(QR.copy());
+    return Algebra.trapezoidalLower(QR.copy());
   }
 
   /**

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SeqBlas.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SeqBlas.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SeqBlas.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/SeqBlas.java Fri Mar  5 17:01:35 2010
@@ -78,7 +78,7 @@
   }
 
   public double dnrm2(DoubleMatrix1D x) {
-    return Math.sqrt(Algebra.DEFAULT.norm2(x));
+    return Math.sqrt(Algebra.norm2(x));
   }
 
   public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s) {
@@ -166,7 +166,7 @@
     if (isUpperTriangular) {
       A = A.viewDice();
     }
-    Property.DEFAULT.checkSquare(A);
+    Property.checkSquare(A);
     int size = A.rows();
     if (size != x.size() && size != y.size()) {
       throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort() + ", " + y.toStringShort());
@@ -192,7 +192,7 @@
       isUpperTriangular = !isUpperTriangular;
     }
 
-    Property.DEFAULT.checkSquare(A);
+    Property.checkSquare(A);
     int size = A.rows();
     if (size != x.size()) {
       throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort());

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -33,7 +33,7 @@
    * @throws IllegalArgumentException if <tt>A.rows() < A.columns()</tt>.
    */
   public SingularValueDecomposition(DoubleMatrix2D Arg) {
-    Property.DEFAULT.checkRectangular(Arg);
+    Property.checkRectangular(Arg);
 
     // Derived from LINPACK code.
     // Initialize.

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestDenseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestDenseVector.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestDenseVector.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestDenseVector.java Fri Mar  5 17:01:35 2010
@@ -28,9 +28,9 @@
 
 public class TestDenseVector extends TestCase {
 
-  final double[] values = {1.1, 2.2, 3.3};
+  private final double[] values = {1.1, 2.2, 3.3};
 
-  final Vector test = new DenseVector(values);
+  private final Vector test = new DenseVector(values);
 
   public TestDenseVector(String name) {
     super(name);
@@ -303,7 +303,7 @@
     other.set(2, -9);
     double expected = test.minus(other).getLengthSquared();
     assertTrue("a.getDistanceSquared(b) != a.minus(b).getLengthSquared",
-        Math.abs(expected - test.getDistanceSquared(other)) < 1e-6);
+        Math.abs(expected - test.getDistanceSquared(other)) < 1.0e-6);
   }
   
   public void testAssignDouble() {

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestSparseVector.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestSparseVector.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestSparseVector.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestSparseVector.java Fri Mar  5 17:01:35 2010
@@ -27,9 +27,9 @@
 
 public class TestSparseVector extends TestCase {
 
-  final double[] values = {1.1, 2.2, 3.3};
-  final double[] gold = {0, 1.1, 2.2, 3.3, 0};
-  final Vector test = new RandomAccessSparseVector(values.length + 2);
+  private final double[] values = {1.1, 2.2, 3.3};
+  private final double[] gold = {0, 1.1, 2.2, 3.3, 0};
+  private final Vector test = new RandomAccessSparseVector(values.length + 2);
 
   public TestSparseVector(String name) {
     super(name);
@@ -339,7 +339,8 @@
     other.set(3, -9);
     other.set(4, 1);
     double expected = test.minus(other).getLengthSquared();
-    assertEquals("a.getDistanceSquared(b) != a.minus(b).getLengthSquared", Math.abs(expected - test.getDistanceSquared(other)) < 10E-7, true);
+    assertTrue("a.getDistanceSquared(b) != a.minus(b).getLengthSquared",
+               Math.abs(expected - test.getDistanceSquared(other)) < 10.0E-7);
   }
 
   public void testAssignDouble() {

Modified: lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestVectorView.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestVectorView.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestVectorView.java (original)
+++ lucene/mahout/trunk/math/src/test/java/org/apache/mahout/math/TestVectorView.java Fri Mar  5 17:01:35 2010
@@ -30,9 +30,9 @@
 
   private static final int offset = 1;
 
-  final double[] values = {0.0, 1.1, 2.2, 3.3, 4.4, 5.5};
+  private final double[] values = {0.0, 1.1, 2.2, 3.3, 4.4, 5.5};
 
-  final Vector test = new VectorView(new DenseVector(values), offset,
+  private final Vector test = new VectorView(new DenseVector(values), offset,
       cardinality);
 
   public TestVectorView(String name) {

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -29,7 +29,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Random;
 
 public class VectorTest extends TestCase {
 
@@ -109,7 +108,7 @@
     dense.setQuick(1, 2);
     dense.setQuick(2, 3);
     assertTrue("equivalent didn't work", AbstractVector.equivalent(dense, right));
-    assertTrue("equals didn't work", dense.equals(right));
+    assertEquals("equals didn't work", dense, right);
 
     RandomAccessSparseVector sparse = new RandomAccessSparseVector(3);
     randomAccessLeft = new RandomAccessSparseVector(3);
@@ -120,17 +119,17 @@
     randomAccessLeft.setQuick(1, 2);
     randomAccessLeft.setQuick(2, 3);
     assertTrue("equivalent didn't work", AbstractVector.equivalent(sparse, randomAccessLeft));
-    assertTrue("equals didn't work", randomAccessLeft.equals(sparse));
+    assertEquals("equals didn't work", randomAccessLeft, sparse);
 
     VectorView v1 = new VectorView(randomAccessLeft, 0, 2);
     VectorView v2 = new VectorView(right, 0, 2);
     assertTrue("equivalent didn't work", AbstractVector.equivalent(v1, v2));
-    assertTrue("equals didn't work", v1.equals(v2));
+    assertEquals("equals didn't work", v1, v2);
     sparse = new RandomAccessSparseVector(2);
     sparse.setQuick(0, 1);
     sparse.setQuick(1, 2);
     assertTrue("equivalent didn't work", AbstractVector.equivalent(v1, sparse));
-    assertTrue("equals didn't work", v1.equals(sparse));
+    assertEquals("equals didn't work", v1, sparse);
 
   }
 
@@ -172,13 +171,13 @@
     
   }
 
-  private void setUpV(Vector v) {
+  private static void setUpV(Vector v) {
     v.setQuick(1, 2);
     v.setQuick(2, -4);
     v.setQuick(3, -9);
   }
 
-  private void setUpW(Vector w) {
+  private static void setUpW(Vector w) {
     w.setQuick(0, -5);
     w.setQuick(1, -1);
     w.setQuick(2, 9);
@@ -189,7 +188,7 @@
   public void doTestGetDistanceSquared(Vector v, Vector w) throws Exception {
     double expected = v.minus(w).getLengthSquared();
     assertTrue("a.getDistanceSquared(b) != a.minus(b).getLengthSquared",
-        Math.abs(expected - v.getDistanceSquared(w)) < 1e-6);
+        Math.abs(expected - v.getDistanceSquared(w)) < 1.0e-6);
   }
 
   public void testGetLengthSquared() throws Exception {
@@ -214,8 +213,7 @@
 
   public void doTestGetLengthSquared(Vector v) throws Exception {
     double expected = lengthSquaredSlowly(v);
-    assertTrue("v.getLengthSquared() != sum_of_squared_elements(v)",
-        expected == v.getLengthSquared());
+    assertEquals("v.getLengthSquared() != sum_of_squared_elements(v)", expected, v.getLengthSquared(), 0.0);
 
     v.set(v.size()/2, v.get(v.size()/2) + 1.0);
     expected = lengthSquaredSlowly(v);
@@ -382,7 +380,7 @@
     vec1.setQuick(2, -2);
 
     double max = vec1.maxValue();
-    assertEquals(max + " does not equal: " + -1, -1, max, 0.0);
+    assertEquals(max + " does not equal: " + (-1.0), -1.0, max, 0.0);
 
     int idx = vec1.maxValueIndex();
     assertEquals(idx + " does not equal: " + 0, 0, idx);
@@ -393,7 +391,7 @@
     vec1.setQuick(2, -2);
     
     max = vec1.maxValue();
-    assertEquals(max + " does not equal: " + 0, 0d, max, 0.0);
+    assertEquals(max + " does not equal: " + 0, 0.0, max, 0.0);
 
     idx = vec1.maxValueIndex();
     assertEquals(idx + " does not equal: " + 1, 1, idx);
@@ -404,7 +402,7 @@
     vec1.setQuick(2, -2);
     
     max = vec1.maxValue();
-    assertEquals(max + " does not equal: " + 0, 0d, max, 0.0);
+    assertEquals(max + " does not equal: " + 0, 0.0, max, 0.0);
 
     idx = vec1.maxValueIndex();
     assertEquals(idx + " does not equal: " + 1, 1, idx);
@@ -415,22 +413,22 @@
     vec1.setQuick(2, -2);
     
     max = vec1.maxValue();
-    assertEquals(max + " does not equal: " + 0, 0d, max, 0.0);
+    assertEquals(max + " does not equal: " + 0, 0.0, max, 0.0);
 
     idx = vec1.maxValueIndex();
     assertEquals(idx + " does not equal: " + 1, 1, idx);
     
     vec1 = new RandomAccessSparseVector(3);
     max = vec1.maxValue();
-    assertEquals(max + " does not equal 0", 0d, max);
+    assertEquals(max + " does not equal 0", 0.0, max);
 
     vec1 = new DenseVector(3);
     max = vec1.maxValue();
-    assertEquals(max + " does not equal 0", 0d, max);
+    assertEquals(max + " does not equal 0", 0.0, max);
 
     vec1 = new SequentialAccessSparseVector(3);
     max = vec1.maxValue();
-    assertEquals(max + " does not equal 0", 0d, max);
+    assertEquals(max + " does not equal 0", 0.0, max);
 
     vec1 = new RandomAccessSparseVector(0);
     max = vec1.maxValue();
@@ -526,7 +524,7 @@
     doTestAggregation(w, v);
   }
 
-  private void doTestAggregation(Vector v, Vector w) throws Exception {
+  private static void doTestAggregation(Vector v, Vector w) throws Exception {
     assertEquals("aggregate(plus, pow(2)) not equal to " + v.getLengthSquared(),
         v.getLengthSquared(),
         v.aggregate(plus, pow(2)));
@@ -545,77 +543,19 @@
         v.aggregate(w, plus, chain(pow(2), minus)));
   }
 
-  private void setUpFirstVector(Vector v) {
+  private static void setUpFirstVector(Vector v) {
     v.setQuick(1, 2);
     v.setQuick(2, 0.5);
     v.setQuick(3, -5);
   }
 
-  private void setUpSecondVector(Vector v) {
+  private static void setUpSecondVector(Vector v) {
     v.setQuick(0, 3);
     v.setQuick(1, -1.5);
     v.setQuick(2, -5);
     v.setQuick(3, 2);
   }
 
-  /*public void testSparseVectorTimesX() {
-    RandomUtils.useTestSeed();
-    Random rnd = RandomUtils.getRandom();
-    Vector v1 = randomSparseVector(rnd);
-    double x = rnd.nextDouble();
-    long t0 = System.currentTimeMillis();
-    RandomAccessSparseVector.optimizeTimes = false;
-    Vector rRef = null;
-    for (int i = 0; i < 10; i++)
-      rRef = v1.times(x);
-    long t1 = System.currentTimeMillis();
-    RandomAccessSparseVector.optimizeTimes = true;
-    Vector rOpt = null;
-    for (int i = 0; i < 10; i++)
-      rOpt = v1.times(x);
-    long t2 = System.currentTimeMillis();
-    long tOpt = t2 - t1;
-    long tRef = t1 - t0;
-    assertTrue(tOpt < tRef);
-    System.out.println("testSparseVectorTimesX tRef-tOpt=" + (tRef - tOpt)
-        + " ms for 10 iterations");
-    for (int i = 0; i < 50000; i++)
-      assertEquals("i=" + i, rRef.getQuick(i), rOpt.getQuick(i));
-  }*/
-
-  /*public void testSparseVectorTimesV() {
-    RandomUtils.useTestSeed();
-    Random rnd = RandomUtils.getRandom();
-    Vector v1 = randomSparseVector(rnd);
-    Vector v2 = randomSparseVector(rnd);
-    long t0 = System.currentTimeMillis();
-    RandomAccessSparseVector.optimizeTimes = false;
-    Vector rRef = null;
-    for (int i = 0; i < 10; i++)
-      rRef = v1.times(v2);
-    long t1 = System.currentTimeMillis();
-    RandomAccessSparseVector.optimizeTimes = true;
-    Vector rOpt = null;
-    for (int i = 0; i < 10; i++)
-      rOpt = v1.times(v2);
-    long t2 = System.currentTimeMillis();
-    long tOpt = t2 - t1;
-    long tRef = t1 - t0;
-    assertTrue(tOpt < tRef);
-    System.out.println("testSparseVectorTimesV tRef-tOpt=" + (tRef - tOpt)
-        + " ms for 10 iterations");
-    for (int i = 0; i < 50000; i++)
-      assertEquals("i=" + i, rRef.getQuick(i), rOpt.getQuick(i));
-  }*/
-
-  private static Vector randomSparseVector(Random rnd) {
-    RandomAccessSparseVector v1 = new RandomAccessSparseVector(50000);
-    for (int i = 0; i < 1000; i++) {
-      v1.setQuick(rnd.nextInt(50000), rnd.nextDouble());
-    }
-    return v1;
-  }
-
   public void testLabelSerializationDense() {
     double[] values = {1.1, 2.2, 3.3};
     Vector test = new DenseVector(values);

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -66,7 +66,7 @@
       Vector afterMultiply = corpus.timesSquared(e);
       double dot = afterMultiply.dot(e);
       double error = 1 - dot / (afterMultiply.norm(2) * e.norm(2));
-      assertTrue("Error margin: " + error + " too high! (for eigen " + i + ")", Math.abs(error) < errorMargin);
+      assertTrue("Error margin: " + error + " too high! (for eigen " + i + ')', Math.abs(error) < errorMargin);
     }
   }
 

Modified: lucene/mahout/trunk/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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -51,7 +51,7 @@
                                 double convergence,
                                 int maxNumPasses,
                                 int desiredRank,
-                                TrainingState state) throws Exception {
+                                TrainingState state) {
     HebbianUpdater updater = new HebbianUpdater();
     SingularVectorVerifier verifier = new AsyncEigenVerifier();
     HebbianSolver solver = new HebbianSolver(updater,
@@ -63,10 +63,10 @@
     assertNotNull(finalState);
     state.setCurrentEigens(finalState.getCurrentEigens());
     state.setCurrentEigenValues(finalState.getCurrentEigenValues());
-    long time = 0;
+    long time = 0L;
     time += System.nanoTime() - start;
     assertEquals(state.getCurrentEigens().numRows(), desiredRank);
-    return (long) (time / 1000000);
+    return (time / 1000000L);
   }
 
 

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java Fri Mar  5 17:01:35 2010
@@ -43,7 +43,6 @@
 import org.apache.mahout.common.distance.CosineDistanceMeasure;
 import org.apache.mahout.common.distance.DistanceMeasure;
 import org.apache.mahout.common.distance.EuclideanDistanceMeasure;
-import org.apache.mahout.common.distance.ManhattanDistanceMeasure;
 import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
 import org.apache.mahout.common.distance.TanimotoDistanceMeasure;
 import org.apache.mahout.math.DenseVector;

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java Fri Mar  5 17:01:35 2010
@@ -180,7 +180,7 @@
     }
   }
   
-  private static void printTopWords(List<List<String>> topWords) throws IOException {
+  private static void printTopWords(List<List<String>> topWords) {
     for (int i = 0; i < topWords.size(); ++i) {
       List<String> topK = topWords.get(i);
       System.out.println("Topic " + i);

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -354,8 +354,8 @@
   }
 
   static class TermIndexWeight {
-    public int index = -1;
-    public double weight = 0;
+    int index = -1;
+    double weight = 0;
 
     TermIndexWeight(int index, double weight) {
       this.index = index;

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -42,7 +42,7 @@
     UNIGRAM('u'),
     NGRAM('n');
     
-    char x;
+    private final char x;
     Type(char c) {
       this.x = c;
     }
@@ -104,9 +104,8 @@
       ByteBuffer bb = Text.encode(ngram + '\0', true);
       bytes = bb.array();
       length = bb.limit();
-    }
-    catch (CharacterCodingException e) {
-      throw new RuntimeException("Should not have happened ",e); 
+    } catch (CharacterCodingException e) {
+      throw new IllegalStateException("Should not have happened ",e);
     }
     
     encodeType(type, bytes, length-1);
@@ -138,7 +137,7 @@
     try {
       return Text.decode(bytes, 0, length-1);
     } catch (CharacterCodingException e) {
-      throw new RuntimeException("Should not have happened " + e.toString()); 
+      throw new IllegalStateException("Should not have happened " + e.toString()); 
     }
   }
 

Modified: lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java (original)
+++ lucene/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java Fri Mar  5 17:01:35 2010
@@ -89,7 +89,7 @@
     }
     
     if (ngramTotal == -1) {
-      throw new RuntimeException("No NGRAM_TOTAL available in job config");
+      throw new IllegalStateException("No NGRAM_TOTAL available in job config");
     }
   }
   

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -67,10 +67,10 @@
 public class ClusterLabels {
   
   class TermInfoClusterInOut implements Comparable<TermInfoClusterInOut> {
-    public final String term;
-    public final int inClusterDF;
-    public final int outClusterDF;
-    public double logLikelihoodRatio;
+    final String term;
+    final int inClusterDF;
+    final int outClusterDF;
+    double logLikelihoodRatio;
     
     TermInfoClusterInOut(String term, int inClusterDF, int outClusterDF) {
       this.term = term;

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java (original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java Fri Mar  5 17:01:35 2010
@@ -40,8 +40,8 @@
 @SuppressWarnings("deprecation")
 public class CollocMapperTest {
   
-  OutputCollector<Gram,Gram> collector;
-  Reporter reporter;
+  private OutputCollector<Gram,Gram> collector;
+  private Reporter reporter;
   
   @Before
   @SuppressWarnings("unchecked")
@@ -160,7 +160,7 @@
   
   /** A lucene 2.9 standard analyzer with no stopwords. */
   public static class TestAnalyzer extends Analyzer {
-    final Analyzer a;
+    private final Analyzer a;
     
     public TestAnalyzer() {
       a = new StandardAnalyzer(Version.LUCENE_29, Collections.emptySet());

Modified: lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java?rev=919495&r1=919494&r2=919495&view=diff
==============================================================================
--- lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java (original)
+++ lucene/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java Fri Mar  5 17:01:35 2010
@@ -37,8 +37,8 @@
  */
 public class CollocReducerTest {
   
-  OutputCollector<Gram,Gram> output;
-  Reporter reporter;
+  private OutputCollector<Gram,Gram> output;
+  private Reporter reporter;
   
   @Before
   @SuppressWarnings("unchecked")

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=919495&r1=919494&r2=919495&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 Fri Mar  5 17:01:35 2010
@@ -48,12 +48,13 @@
   private static final Logger log =
     LoggerFactory.getLogger(LLRReducerTest.class);
   
-  Reporter reporter;
-  LLCallback ll;
-  LLCallback cl;
+  private Reporter reporter;
+  private LLCallback ll;
+  private LLCallback cl;
+
   // not verifying the llr algo output here, just the input, but it is handy
   // to see the values emitted.
-  OutputCollector<Text,DoubleWritable> collector = new OutputCollector<Text,DoubleWritable>() {
+  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());



Mime
View raw message