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/08/13 20:19:18 UTC

svn commit: r985313 [2/2] - in /mahout/trunk: examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/ examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/ examples/src/main/java/org/apache/mahout/cf/taste/example/jester/...

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ExecutionPanel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ExecutionPanel.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ExecutionPanel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ExecutionPanel.java Fri Aug 13 18:19:16 2010
@@ -18,6 +18,7 @@
 package org.apache.mahout.ga.watchmaker.travellingsalesman;
 
 import java.awt.BorderLayout;
+import java.awt.Container;
 import java.awt.Font;
 import java.awt.event.ActionListener;
 
@@ -45,7 +46,7 @@ final class ExecutionPanel extends JPane
   
   ExecutionPanel() {
     super(new BorderLayout());
-    JPanel controlPanel = new JPanel(new BorderLayout());
+    Container controlPanel = new JPanel(new BorderLayout());
     startButton = new JButton("Start");
     controlPanel.add(startButton, BorderLayout.WEST);
     progressBar = new JProgressBar(0, 100);

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java Fri Aug 13 18:19:16 2010
@@ -18,12 +18,12 @@
 package org.apache.mahout.ga.watchmaker.travellingsalesman;
 
 import java.awt.BorderLayout;
+import java.awt.Container;
 import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -44,10 +44,10 @@ final class ItineraryPanel extends JPane
   private final JButton selectAllButton;
   private final JButton clearButton;
   
-  ItineraryPanel(List<String> cities) {
+  ItineraryPanel(Collection<String> cities) {
     super(new BorderLayout());
     
-    JPanel checkBoxPanel = new JPanel(new GridLayout(0, 1));
+    Container checkBoxPanel = new JPanel(new GridLayout(0, 1));
     checkBoxes = new ArrayList<JCheckBox>(cities.size());
     for (String city : cities) {
       JCheckBox checkBox = new JCheckBox(city, false);
@@ -56,7 +56,7 @@ final class ItineraryPanel extends JPane
     }
     add(checkBoxPanel, BorderLayout.CENTER);
     
-    JPanel buttonPanel = new JPanel(new GridLayout(2, 1));
+    Container buttonPanel = new JPanel(new GridLayout(2, 1));
     selectAllButton = new JButton("Select All");
     buttonPanel.add(selectAllButton);
     clearButton = new JButton("Clear Selection");

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java Fri Aug 13 18:19:16 2010
@@ -19,6 +19,7 @@ package org.apache.mahout.ga.watchmaker.
 
 import java.awt.BorderLayout;
 import java.awt.Component;
+import java.awt.Container;
 import java.awt.FlowLayout;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
@@ -91,11 +92,7 @@ final class StrategyPanel extends JPanel
   }
   
   public TravellingSalesmanStrategy getStrategy() {
-    if (bruteForceOption.isSelected()) {
-      return new BruteForceTravellingSalesman(distances);
-    } else {
-      return evolutionPanel.getStrategy();
-    }
+    return bruteForceOption.isSelected() ? new BruteForceTravellingSalesman(distances) : evolutionPanel.getStrategy();
   }
   
   @Override
@@ -134,7 +131,7 @@ final class StrategyPanel extends JPanel
     
     EvolutionPanel() {
       super(new FlowLayout(FlowLayout.LEFT, 0, 0));
-      JPanel innerPanel = new JPanel(new SpringLayout());
+      Container innerPanel = new JPanel(new SpringLayout());
       
       populationLabel = new JLabel("Population Size: ");
       populationSpinner = new JSpinner(new SpinnerNumberModel(300, 2, 10000, 1));

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/TravellingSalesman.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/TravellingSalesman.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/TravellingSalesman.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/travellingsalesman/TravellingSalesman.java Fri Aug 13 18:19:16 2010
@@ -18,6 +18,7 @@
 package org.apache.mahout.ga.watchmaker.travellingsalesman;
 
 import java.awt.BorderLayout;
+import java.awt.Container;
 import java.awt.Frame;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -40,12 +41,10 @@ import org.uncommons.watchmaker.framewor
  * This class has been modified to add a main function that runs the JApplet inside a JDialog.
  */
 public final class TravellingSalesman extends JApplet {
+
   private final ItineraryPanel itineraryPanel;
-  
   private final StrategyPanel strategyPanel;
-  
   private final ExecutionPanel executionPanel;
-  
   private final FitnessEvaluator<List<String>> evaluator;
   
   /**
@@ -58,7 +57,7 @@ public final class TravellingSalesman ex
     strategyPanel = new StrategyPanel(distances);
     executionPanel = new ExecutionPanel();
     add(itineraryPanel, BorderLayout.WEST);
-    JPanel innerPanel = new JPanel(new BorderLayout());
+    Container innerPanel = new JPanel(new BorderLayout());
     innerPanel.add(strategyPanel, BorderLayout.NORTH);
     innerPanel.add(executionPanel, BorderLayout.CENTER);
     add(innerPanel, BorderLayout.CENTER);
@@ -92,54 +91,9 @@ public final class TravellingSalesman ex
    *          The set of cities to generate a route for.
    * @return A Swing task that will execute on a background thread and update the GUI when it is done.
    */
-  private SwingBackgroundTask<List<String>> createTask(final Collection<String> cities) {
-    final TravellingSalesmanStrategy strategy = strategyPanel.getStrategy();
-    return new SwingBackgroundTask<List<String>>() {
-      private long elapsedTime;
-      
-      @Override
-      protected List<String> performTask() {
-        long startTime = System.currentTimeMillis();
-        List<String> result = strategy.calculateShortestRoute(cities, executionPanel);
-        elapsedTime = System.currentTimeMillis() - startTime;
-        return result;
-      }
-      
-      @Override
-      protected void postProcessing(List<String> result) {
-        executionPanel.appendOutput(createResultString(strategy.getDescription(), result,
-          evaluator.getFitness(result, null), elapsedTime));
-        setEnabled(true);
-      }
-    };
-  }
-  
-  /**
-   * Helper method for formatting a result as a string for display.
-   */
-  private static String createResultString(String strategyDescription,
-                                           List<String> shortestRoute,
-                                           double distance,
-                                           long elapsedTime) {
-    StringBuilder buffer = new StringBuilder(100);
-    buffer.append('[');
-    buffer.append(strategyDescription);
-    buffer.append("]\n");
-    buffer.append("ROUTE: ");
-    for (String s : shortestRoute) {
-      buffer.append(s);
-      buffer.append(" -> ");
-    }
-    buffer.append(shortestRoute.get(0));
-    buffer.append('\n');
-    buffer.append("TOTAL DISTANCE: ");
-    buffer.append(String.valueOf(distance));
-    buffer.append("km\n");
-    buffer.append("(Search Time: ");
-    double seconds = (double) elapsedTime / 1000;
-    buffer.append(String.valueOf(seconds));
-    buffer.append(" seconds)\n\n");
-    return buffer.toString();
+  private SwingBackgroundTask<List<String>> createTask(Collection<String> cities) {
+    TravellingSalesmanStrategy strategy = strategyPanel.getStrategy();
+    return new TSSwingBackgroundTask(strategy, cities, executionPanel, evaluator);
   }
   
   /**
@@ -166,4 +120,66 @@ public final class TravellingSalesman ex
     
     dialog.setVisible(true);
   }
+
+  private class TSSwingBackgroundTask extends SwingBackgroundTask<List<String>> {
+
+    private long elapsedTime;
+    private final TravellingSalesmanStrategy strategy;
+    private final Collection<String> cities;
+    private final ExecutionPanel executionPanel;
+    private final FitnessEvaluator<List<String>> evaluator;
+
+    private TSSwingBackgroundTask(TravellingSalesmanStrategy strategy,
+                                  Collection<String> cities,
+                                  ExecutionPanel executionPanel,
+                                  FitnessEvaluator<List<String>> evaluator) {
+      this.strategy = strategy;
+      this.cities = cities;
+      this.executionPanel = executionPanel;
+      this.evaluator = evaluator;
+    }
+
+    @Override
+    protected List<String> performTask() {
+      long startTime = System.currentTimeMillis();
+      List<String> result = strategy.calculateShortestRoute(cities, executionPanel);
+      elapsedTime = System.currentTimeMillis() - startTime;
+      return result;
+    }
+
+    @Override
+    protected void postProcessing(List<String> result) {
+      executionPanel.appendOutput(createResultString(strategy.getDescription(), result,
+        evaluator.getFitness(result, null), elapsedTime));
+      setEnabled(true);
+    }
+
+    /**
+     * Helper method for formatting a result as a string for display.
+     */
+    private String createResultString(String strategyDescription,
+                                      List<String> shortestRoute,
+                                      double distance,
+                                      long elapsedTime) {
+      StringBuilder buffer = new StringBuilder(100);
+      buffer.append('[');
+      buffer.append(strategyDescription);
+      buffer.append("]\n");
+      buffer.append("ROUTE: ");
+      for (String s : shortestRoute) {
+        buffer.append(s);
+        buffer.append(" -> ");
+      }
+      buffer.append(shortestRoute.get(0));
+      buffer.append('\n');
+      buffer.append("TOTAL DISTANCE: ");
+      buffer.append(String.valueOf(distance));
+      buffer.append("km\n");
+      buffer.append("(Search Time: ");
+      double seconds = (double) elapsedTime / 1000;
+      buffer.append(String.valueOf(seconds));
+      buffer.append(" seconds)\n\n");
+      return buffer.toString();
+    }
+  }
 }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java Fri Aug 13 18:19:16 2010
@@ -59,9 +59,6 @@ public class WikipediaMapper extends Map
 
   private boolean all;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#map(java.lang.Object, java.lang.Object, org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
 
@@ -89,9 +86,6 @@ public class WikipediaMapper extends Map
     context.write(new Text(SPACE_NON_ALPHA_PATTERN.matcher(title).replaceAll("_")), new Text(document));
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#setup(org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);
@@ -112,7 +106,8 @@ public class WikipediaMapper extends Map
     } catch (IOException ex) {
       throw new IllegalStateException(ex);
     }
-    log.info("Configure: Input Categories size: {} All: {} Exact Match: {}", new Object[] { inputCategories.size(), all,
+    log.info("Configure: Input Categories size: {} All: {} Exact Match: {}",
+             new Object[] { inputCategories.size(), all,
         exactMatchOnly });
   }
 
@@ -122,7 +117,7 @@ public class WikipediaMapper extends Map
     return xml.substring(start, end);
   }
 
-  private static String getTitle(String xml) {
+  private static String getTitle(CharSequence xml) {
     Matcher m = TITLE.matcher(xml);
     return m.find() ? m.group(1) : "";
   }

Modified: mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java (original)
+++ mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDRuleTest.java Fri Aug 13 18:19:16 2010
@@ -81,7 +81,7 @@ public class CDRuleTest extends MahoutTe
 
     // the dataline has all its attributes set to 0d
     DataLine dl = EasyMock.createMock(DataLine.class);
-    EasyMock.expect(dl.getAttribut(EasyMock.anyInt())).andReturn(0.0).atLeastOnce();
+    EasyMock.expect(dl.getAttribute(EasyMock.anyInt())).andReturn(0.0).atLeastOnce();
     EasyMock.replay(dl);
 
     // all the conditions are : attribut < 0
@@ -117,7 +117,7 @@ public class CDRuleTest extends MahoutTe
 
     // the dataline has all its attributes set to 1d
     DataLine dl = EasyMock.createMock(DataLine.class);
-    EasyMock.expect(dl.getAttribut(EasyMock.anyInt())).andReturn(1.0).atLeastOnce();
+    EasyMock.expect(dl.getAttribute(EasyMock.anyInt())).andReturn(1.0).atLeastOnce();
     EasyMock.replay(dl);
 
     int n = 100; // repeat the test n times
@@ -150,7 +150,7 @@ public class CDRuleTest extends MahoutTe
 
     // the dataline has all its attributes set to 1d
     DataLine dl = EasyMock.createMock(DataLine.class);
-    EasyMock.expect(dl.getAttribut(EasyMock.anyInt())).andReturn(1.0).atLeastOnce();
+    EasyMock.expect(dl.getAttribute(EasyMock.anyInt())).andReturn(1.0).atLeastOnce();
     EasyMock.replay(dl);
 
     int n = 100; // repeat the test n times

Modified: mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java (original)
+++ mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java Fri Aug 13 18:19:16 2010
@@ -43,10 +43,10 @@ public class FileInfosDatasetTest extend
       dl.set(line);
       for (int index = 0; index < dataset.getNbAttributes(); index++) {
         if (dataset.isNumerical(index)) {
-          assertInRange(dl.getAttribut(index), dataset.getMin(index), dataset
+          assertInRange(dl.getAttribute(index), dataset.getMin(index), dataset
               .getMax(index));
         } else {
-          assertInRange(dl.getAttribut(index), 0, dataset.getNbValues(index));
+          assertInRange(dl.getAttribute(index), 0, dataset.getNbValues(index));
         }
       }
     }

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java Fri Aug 13 18:19:16 2010
@@ -41,6 +41,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.SequenceFile;
+import org.apache.hadoop.io.Writable;
 import org.apache.mahout.common.CommandLineUtil;
 import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.common.Summarizable;
@@ -268,7 +269,7 @@ public class VectorBenchmarks implements
     SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf,
       new Path("/tmp/dense-vector"), IntWritable.class, VectorWritable.class);
 
-    IntWritable one = new IntWritable(0);
+    Writable one = new IntWritable(0);
     VectorWritable vec = new VectorWritable();
     
     TimingStatistics stats = new TimingStatistics();
@@ -320,8 +321,8 @@ public class VectorBenchmarks implements
     SequenceFile.Reader reader = new SequenceFile.Reader(fs,
       new Path("/tmp/dense-vector"), conf);
 
-    IntWritable one = new IntWritable(0);
-    VectorWritable vec = new VectorWritable();
+    Writable one = new IntWritable(0);
+    Writable vec = new VectorWritable();
     TimingStatistics stats = new TimingStatistics();
     for (int l = 0; l < loop; l++) {
       for (int i = 0; i < numVectors; i++) {

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java Fri Aug 13 18:19:16 2010
@@ -46,7 +46,7 @@ public final class CDbwDriver extends Ab
 
   public static final String DISTANCE_MEASURE_KEY = "org.apache.mahout.clustering.dirichlet.modelFactory";
 
-  public static final String NUM_CLUSTERS_KEY = "org.apache.mahout.clustering.dirichlet.numClusters";
+  //public static final String NUM_CLUSTERS_KEY = "org.apache.mahout.clustering.dirichlet.numClusters";
 
   private static final Logger log = LoggerFactory.getLogger(CDbwDriver.class);
 
@@ -57,8 +57,9 @@ public final class CDbwDriver extends Ab
     new CDbwDriver().run(args);
   }
 
-  public int run(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException,
-      InterruptedException {
+  @Override
+  public int run(String[] args)
+      throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, InterruptedException {
     addInputOption();
     addOutputOption();
     addOption(DefaultOptionCreator.distanceMeasureOption().create());
@@ -99,19 +100,19 @@ public final class CDbwDriver extends Ab
                             Path output,
                             String distanceMeasureClass,
                             int numIterations,
-                            int numReducers) throws ClassNotFoundException, InstantiationException, IllegalAccessException,
-      IOException, InterruptedException {
-
-    new CDbwDriver().job(clustersIn, clusteredPointsIn, output, distanceMeasureClass, numIterations, numReducers);
+                            int numReducers)
+      throws ClassNotFoundException, InstantiationException, IllegalAccessException,
+        IOException, InterruptedException {
+    job(clustersIn, clusteredPointsIn, output, distanceMeasureClass, numIterations, numReducers);
   }
 
-  private void job(Path clustersIn,
-                   Path clusteredPointsIn,
-                   Path output,
-                   String distanceMeasureClass,
-                   int numIterations,
-                   int numReducers) throws InstantiationException, IllegalAccessException, IOException, InterruptedException,
-      ClassNotFoundException {
+  private static void job(Path clustersIn,
+                          Path clusteredPointsIn,
+                          Path output,
+                          String distanceMeasureClass,
+                          int numIterations,
+                          int numReducers)
+      throws InstantiationException, IllegalAccessException, IOException, InterruptedException, ClassNotFoundException {
     Path stateIn = new Path(output, "representativePoints-0");
     writeInitialState(stateIn, clustersIn);
 
@@ -172,11 +173,12 @@ public final class CDbwDriver extends Ab
    *          the class name of the DistanceMeasure class
    * @param numReducers
    *          the number of Reducers desired
-   * @throws IOException 
-   * @throws ClassNotFoundException 
-   * @throws InterruptedException 
    */
-  private static void runIteration(Path input, Path stateIn, Path stateOut, String distanceMeasureClass, int numReducers)
+  private static void runIteration(Path input,
+                                   Path stateIn,
+                                   Path stateOut,
+                                   String distanceMeasureClass,
+                                   int numReducers)
       throws IOException, InterruptedException, ClassNotFoundException {
     Configuration conf = new Configuration();
     conf.set(STATE_IN_KEY, stateIn.toString());

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java Fri Aug 13 18:19:16 2010
@@ -251,6 +251,7 @@ public class CDbwEvaluator {
     stDevs.put(cI, d);
   }
 
+  /*
   double minRpDistance(Iterable<VectorWritable> repI, Iterable<VectorWritable> repJ) {
     double minDistance = Double.MAX_VALUE;
     for (VectorWritable aRepI : repI) {
@@ -263,6 +264,7 @@ public class CDbwEvaluator {
     }
     return minDistance;
   }
+   */
 
   double intraDensity(Vector clusterCenter, Vector repPoint, double avgStd) {
     return measure.distance(clusterCenter, repPoint) <= avgStd ? 1.0 : 0.0;

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java Fri Aug 13 18:19:16 2010
@@ -40,24 +40,18 @@ public class CDbwMapper extends Mapper<I
 
   private Map<Integer, List<VectorWritable>> representativePoints;
 
-  private Map<Integer, WeightedVectorWritable> mostDistantPoints = new HashMap<Integer, WeightedVectorWritable>();
+  private final Map<Integer, WeightedVectorWritable> mostDistantPoints = new HashMap<Integer, WeightedVectorWritable>();
 
   private DistanceMeasure measure = new EuclideanDistanceMeasure();
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#cleanup(org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void cleanup(Context context) throws IOException, InterruptedException {
-    for (Integer clusterId : mostDistantPoints.keySet()) {
-      context.write(new IntWritable(clusterId), mostDistantPoints.get(clusterId));
+    for (Map.Entry<Integer, WeightedVectorWritable> entry : mostDistantPoints.entrySet()) {
+      context.write(new IntWritable(entry.getKey()), entry.getValue());
     }
     super.cleanup(context);
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#map(java.lang.Object, java.lang.Object, org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void map(IntWritable clusterId, WeightedVectorWritable point, Context context) throws IOException, InterruptedException {
     int key = clusterId.get();
@@ -73,9 +67,6 @@ public class CDbwMapper extends Mapper<I
     }
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#setup(org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwReducer.java Fri Aug 13 18:19:16 2010
@@ -18,7 +18,6 @@
 package org.apache.mahout.clustering.cdbw;
 
 import java.io.IOException;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -32,30 +31,23 @@ public class CDbwReducer extends Reducer
 
   private Map<Integer, List<VectorWritable>> referencePoints;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#cleanup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void cleanup(Context context) throws IOException, InterruptedException {
-    for (Integer clusterId : referencePoints.keySet()) {
-      for (VectorWritable vw : referencePoints.get(clusterId)) {
-        context.write(new IntWritable(clusterId), vw);
+    for (Map.Entry<Integer, List<VectorWritable>> entry : referencePoints.entrySet()) {
+      IntWritable iw = new IntWritable(entry.getKey());
+      for (VectorWritable vw : entry.getValue()) {
+        context.write(iw, vw);
       }
     }
     super.cleanup(context);
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void reduce(IntWritable key, Iterable<WeightedVectorWritable> values, Context context) throws IOException,
       InterruptedException {
     // find the most distant point
     WeightedVectorWritable mdp = null;
-    Iterator<WeightedVectorWritable> it = values.iterator();
-    while (it.hasNext()) {
-      WeightedVectorWritable dpw = it.next();
+    for (WeightedVectorWritable dpw : values) {
       if (mdp == null || mdp.getWeight() < dpw.getWeight()) {
         mdp = new WeightedVectorWritable(dpw.getWeight(), dpw.getVector());
       }
@@ -63,9 +55,6 @@ public class CDbwReducer extends Reducer
     context.write(new IntWritable(key.get()), mdp.getVector());
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/lda/LDAPrintTopics.java Fri Aug 13 18:19:16 2010
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.PriorityQueue;
@@ -84,7 +85,7 @@ public final class LDAPrintTopics {
   }
   
   // Expands the queue list to have a Queue for topic K
-  private static void ensureQueueSize(List<PriorityQueue<StringDoublePair>> queues, int k) {
+  private static void ensureQueueSize(Collection<PriorityQueue<StringDoublePair>> queues, int k) {
     for (int i = queues.size(); i <= k; ++i) {
       queues.add(new PriorityQueue<StringDoublePair>());
     }
@@ -193,10 +194,10 @@ public final class LDAPrintTopics {
     }
   }
   
-  public static List<List<String>> topWordsForTopics(String dir,
-                                                     Configuration job,
-                                                     List<String> wordList,
-                                                     int numWordsToPrint) throws IOException {
+  private static List<List<String>> topWordsForTopics(String dir,
+                                                      Configuration job,
+                                                      List<String> wordList,
+                                                      int numWordsToPrint) throws IOException {
     FileSystem fs = new Path(dir).getFileSystem(job);
     
     List<PriorityQueue<StringDoublePair>> queues = new ArrayList<PriorityQueue<StringDoublePair>>();

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java Fri Aug 13 18:19:16 2010
@@ -26,7 +26,6 @@ import org.apache.lucene.util.Version;
  */
 public class DefaultAnalyzer extends StandardAnalyzer {
 
-  @SuppressWarnings("deprecation")
   public DefaultAnalyzer() {
     super(Version.LUCENE_CURRENT);
   }

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java Fri Aug 13 18:19:16 2010
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
@@ -302,7 +303,7 @@ public final class ClusterDumper extends
   static class TermIndexWeight {
     private int index = -1;
 
-    private double weight;
+    private final double weight;
 
     TermIndexWeight(int index, double weight) {
       this.index = index;
@@ -328,7 +329,7 @@ public final class ClusterDumper extends
       }
     });
 
-    List<Pair<String, Double>> topTerms = new LinkedList<Pair<String, Double>>();
+    Collection<Pair<String, Double>> topTerms = new LinkedList<Pair<String, Double>>();
 
     for (int i = 0; (i < vectorTerms.size()) && (i < numTerms); i++) {
       int index = vectorTerms.get(i).index;

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java Fri Aug 13 18:19:16 2010
@@ -18,32 +18,26 @@
 package org.apache.mahout.utils.nlp.collocations.llr;
 
 import java.io.IOException;
-import java.util.Iterator;
 
 import org.apache.hadoop.mapreduce.Reducer;
 
 /** Combiner for pass1 of the CollocationDriver. Combines frequencies for values for the same key */
 public class CollocCombiner extends Reducer<GramKey, Gram, GramKey, Gram> {
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void reduce(GramKey key, Iterable<Gram> values, Context context) throws IOException, InterruptedException {
 
     int freq = 0;
-    Gram value = null;
 
     // accumulate frequencies from values.
-    Iterator<Gram> it = values.iterator();
-    while (it.hasNext()) {
-      value = it.next();
-      freq += value.getFrequency();
+    for (Gram gramValue : values) {
+      freq += gramValue.getFrequency();
     }
 
-    value.setFrequency(freq);
+    Gram sum = new Gram();
+    sum.setFrequency(freq);
 
-    context.write(key, value);
+    context.write(key, sum);
   }
 
 }

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocDriver.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocDriver.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocDriver.java Fri Aug 13 18:19:16 2010
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
 
 /** Driver for LLR Collocation discovery mapreduce job */
 public final class CollocDriver extends AbstractJob {
-  public static final String DEFAULT_OUTPUT_DIRECTORY = "output";
+  //public static final String DEFAULT_OUTPUT_DIRECTORY = "output";
 
   public static final String SUBGRAM_OUTPUT_DIRECTORY = "subgrams";
 
@@ -52,9 +52,9 @@ public final class CollocDriver extends 
 
   public static final boolean DEFAULT_EMIT_UNIGRAMS = false;
 
-  public static final int DEFAULT_MAX_NGRAM_SIZE = 2;
+  private static final int DEFAULT_MAX_NGRAM_SIZE = 2;
 
-  public static final int DEFAULT_PASS1_NUM_REDUCE_TASKS = 1;
+  private static final int DEFAULT_PASS1_NUM_REDUCE_TASKS = 1;
 
   private static final Logger log = LoggerFactory.getLogger(CollocDriver.class);
 
@@ -194,13 +194,14 @@ public final class CollocDriver extends 
   /**
    * pass1: generate collocations, ngrams
    */
-  public static long generateCollocations(Path input,
-                                          Path output,
-                                          Configuration baseConf,
-                                          boolean emitUnigrams,
-                                          int maxNGramSize,
-                                          int reduceTasks,
-                                          int minSupport) throws IOException, ClassNotFoundException, InterruptedException {
+  private static long generateCollocations(Path input,
+                                           Path output,
+                                           Configuration baseConf,
+                                           boolean emitUnigrams,
+                                           int maxNGramSize,
+                                           int reduceTasks,
+                                           int minSupport)
+      throws IOException, ClassNotFoundException, InterruptedException {
 
     Configuration con = new Configuration(baseConf);
     con.setBoolean(EMIT_UNIGRAMS, emitUnigrams);
@@ -240,15 +241,14 @@ public final class CollocDriver extends 
 
   /**
    * pass2: perform the LLR calculation
-   * @throws ClassNotFoundException 
-   * @throws InterruptedException 
    */
-  public static void computeNGramsPruneByLLR(Path output,
-                                             Configuration baseConf,
-                                             long nGramTotal,
-                                             boolean emitUnigrams,
-                                             float minLLRValue,
-                                             int reduceTasks) throws IOException, InterruptedException, ClassNotFoundException {
+  private static void computeNGramsPruneByLLR(Path output,
+                                              Configuration baseConf,
+                                              long nGramTotal,
+                                              boolean emitUnigrams,
+                                              float minLLRValue,
+                                              int reduceTasks)
+      throws IOException, InterruptedException, ClassNotFoundException {
     Configuration conf = new Configuration(baseConf);
     conf.setLong(LLRReducer.NGRAM_TOTAL, nGramTotal);
     conf.setBoolean(EMIT_UNIGRAMS, emitUnigrams);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapper.java Fri Aug 13 18:19:16 2010
@@ -44,7 +44,7 @@ public class CollocMapper extends Mapper
 
   public static final String MAX_SHINGLE_SIZE = "maxShingleSize";
 
-  public static final int DEFAULT_MAX_SHINGLE_SIZE = 2;
+  private static final int DEFAULT_MAX_SHINGLE_SIZE = 2;
 
   public enum Count {
     NGRAM_TOTAL
@@ -85,12 +85,6 @@ public class CollocMapper extends Mapper
    * CollocDriver.Count.NGRAM_TOTAL
    * </p>
    * 
-   * @param collector
-   *          The collector to send output to
-   * 
-   * @param reporter
-   *          Used to deliver the final ngram-count.
-   * 
    * @throws IOException
    *           if there's a problem with the ShingleFilter reading data or the collector collecting output.
    */
@@ -104,8 +98,8 @@ public class CollocMapper extends Mapper
     OpenObjectIntHashMap<String> unigrams = new OpenObjectIntHashMap<String>(value.getEntries().size());
 
     do {
-      String term = ((TermAttribute) sf.getAttribute(TermAttribute.class)).term();
-      String type = ((TypeAttribute) sf.getAttribute(TypeAttribute.class)).type();
+      String term = (sf.getAttribute(TermAttribute.class)).term();
+      String type = (sf.getAttribute(TypeAttribute.class)).type();
       if ("shingle".equals(type)) {
         count++;
         ngrams.adjustOrPutValue(term, 1, 1);
@@ -182,9 +176,6 @@ public class CollocMapper extends Mapper
     sf.close();
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#setup(org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);
@@ -207,7 +198,7 @@ public class CollocMapper extends Mapper
 
     public IteratorTokenStream(Iterator<String> iterator) {
       this.iterator = iterator;
-      this.termAtt = (TermAttribute) addAttribute(TermAttribute.class);
+      this.termAtt = addAttribute(TermAttribute.class);
     }
 
     @Override

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducer.java Fri Aug 13 18:19:16 2010
@@ -82,9 +82,6 @@ public class CollocReducer extends Reduc
     }
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);
@@ -99,9 +96,9 @@ public class CollocReducer extends Reduc
 
   /**
    * Sum frequencies for unigrams and deliver to the collector
-   * @throws InterruptedException 
    */
-  protected void processUnigram(GramKey key, Iterator<Gram> values, Context context) throws IOException, InterruptedException {
+  protected void processUnigram(GramKey key, Iterator<Gram> values, Context context)
+      throws IOException, InterruptedException {
 
     int freq = 0;
     Gram value = null;

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparator.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparator.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyGroupComparator.java Fri Aug 13 18:19:16 2010
@@ -23,9 +23,9 @@ import org.apache.hadoop.io.WritableComp
 /** Group GramKeys based on their Gram, ignoring the secondary sort key, so that all keys with the same Gram are sent
  *  to the same call of the reduce method, sorted in natural order (for GramKeys).
  */
-public class GramKeyGroupComparator extends WritableComparator {
+class GramKeyGroupComparator extends WritableComparator {
 
-  protected GramKeyGroupComparator() {
+  GramKeyGroupComparator() {
     super(GramKey.class, true);
   }
 

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducer.java Fri Aug 13 18:19:16 2010
@@ -78,9 +78,7 @@ public class LLRReducer extends Reducer<
     // FIXME: better way to handle errors? Wouldn't an exception thrown here
     // cause hadoop to re-try the job?
     String[] gram = new String[2];
-    Iterator<Gram> it = values.iterator();
-    while (it.hasNext()) {
-      Gram value = it.next();
+    for (Gram value : values) {
 
       int pos = value.getType() == Gram.Type.HEAD ? 0 : 1;
 
@@ -132,9 +130,6 @@ public class LLRReducer extends Reducer<
     }
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/RowIdJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/RowIdJob.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/RowIdJob.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/RowIdJob.java Fri Aug 13 18:19:16 2010
@@ -24,6 +24,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.mahout.common.AbstractJob;
 import org.apache.mahout.math.VectorWritable;
@@ -52,7 +53,7 @@ public class RowIdJob extends AbstractJo
                                                                  IntWritable.class,
                                                                  VectorWritable.class);
     IntWritable docId = new IntWritable();
-    Text inputKey = new Text();
+    Writable inputKey = new Text();
     VectorWritable v = new VectorWritable();
 
     int i = 0;

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java Fri Aug 13 18:19:16 2010
@@ -31,6 +31,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
 import org.apache.mahout.common.FileLineIterator;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.map.OpenObjectIntHashMap;
@@ -95,7 +96,7 @@ public final class VectorHelper {
   public static String[] loadTermDictionary(Configuration conf, FileSystem fs, String filePattern) throws IOException {
     FileStatus[] dictionaryFiles = fs.globStatus(new Path(filePattern));
     OpenObjectIntHashMap<String> dict = new OpenObjectIntHashMap<String>();
-    Text key = new Text();
+    Writable key = new Text();
     IntWritable value = new IntWritable();
     for (FileStatus fileStatus : dictionaryFiles) {
       Path path = fileStatus.getPath();
@@ -119,7 +120,7 @@ public final class VectorHelper {
    * term DocFreq Index
    * </pre>
    */
-  public static String[] loadTermDictionary(InputStream is) throws IOException {
+  private static String[] loadTermDictionary(InputStream is) throws IOException {
     FileLineIterator it = new FileLineIterator(is);
     
     int numEntries = Integer.parseInt(it.next());

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMergeReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMergeReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMergeReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMergeReducer.java Fri Aug 13 18:19:16 2010
@@ -41,17 +41,12 @@ public class PartialVectorMergeReducer e
 
   private boolean sequentialAccess;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context) throws IOException,
       InterruptedException {
 
     Vector vector = new RandomAccessSparseVector(dimension, 10);
-    Iterator<VectorWritable> it = values.iterator();
-    while (it.hasNext()) {
-      VectorWritable value = it.next();
+    for (VectorWritable value : values) {
       value.get().addTo(vector);
     }
     if (normPower != PartialVectorMerger.NO_NORMALIZING) {
@@ -64,9 +59,6 @@ public class PartialVectorMergeReducer e
     context.write(key, vectorWritable);
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java Fri Aug 13 18:19:16 2010
@@ -112,7 +112,7 @@ public final class PartialVectorMerger {
     job.waitForCompletion(true);
   }
 
-  private static String getCommaSeparatedPaths(List<Path> paths) {
+  private static String getCommaSeparatedPaths(Iterable<Path> paths) {
     StringBuilder commaSeparatedPaths = new StringBuilder();
     String sep = "";
     for (Path path : paths) {

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java Fri Aug 13 18:19:16 2010
@@ -22,6 +22,7 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.LinkedHashMap;
@@ -179,7 +180,7 @@ public class ClusterLabels {
   /**
    * Get the list of labels, sorted by best score.
    */
-  protected List<TermInfoClusterInOut> getClusterLabels(Integer integer, List<WeightedVectorWritable> wvws)
+  protected List<TermInfoClusterInOut> getClusterLabels(Integer integer, Collection<WeightedVectorWritable> wvws)
       throws IOException {
 
     if (wvws.size() < minNumIds) {
@@ -266,7 +267,7 @@ public class ClusterLabels {
     return clusteredTermInfo.subList(0, Math.min(clusteredTermInfo.size(), maxLabels));
   }
 
-  private static OpenBitSet getClusterDocBitset(IndexReader reader, Set<String> idSet, String idField)
+  private static OpenBitSet getClusterDocBitset(IndexReader reader, Collection<String> idSet, String idField)
       throws IOException {
     int numDocs = reader.numDocs();
 

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/LuceneIterable.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/LuceneIterable.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/LuceneIterable.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/LuceneIterable.java Fri Aug 13 18:19:16 2010
@@ -124,10 +124,10 @@ public class LuceneIterable implements I
         } else {
           name = String.valueOf(doc);
         }
-        if (normPower != NO_NORMALIZING) {
-          result = new NamedVector(result.normalize(normPower), name);
-        } else {
+        if (normPower == NO_NORMALIZING) {
           result = new NamedVector(result, name);
+        } else {
+          result = new NamedVector(result.normalize(normPower), name);
         }
       } catch (IOException e) {
         // Log?

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DocumentProcessor.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DocumentProcessor.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DocumentProcessor.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/DocumentProcessor.java Fri Aug 13 18:19:16 2010
@@ -18,7 +18,6 @@
 package org.apache.mahout.utils.vectors.text;
 
 import java.io.IOException;
-import java.nio.charset.Charset;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -47,7 +46,7 @@ public final class DocumentProcessor {
   public static final String TOKENIZED_DOCUMENT_OUTPUT_FOLDER = "tokenized-documents";
   public static final String ANALYZER_CLASS = "analyzer.class";
   
-  public static final Charset CHARSET = Charset.forName("UTF-8");
+  //public static final Charset CHARSET = Charset.forName("UTF-8");
   
   /**
    * Cannot be initialized. Use the static functions

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/document/SequenceFileTokenizerMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/document/SequenceFileTokenizerMapper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/document/SequenceFileTokenizerMapper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/document/SequenceFileTokenizerMapper.java Fri Aug 13 18:19:16 2010
@@ -36,9 +36,6 @@ public class SequenceFileTokenizerMapper
 
   private Analyzer analyzer;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#map(java.lang.Object, java.lang.Object, org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void map(Text key, Text value, Context context) throws IOException, InterruptedException {
     TokenStream stream = analyzer.tokenStream(key.toString(), new StringReader(value.toString()));
@@ -52,9 +49,6 @@ public class SequenceFileTokenizerMapper
     context.write(key, document);
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#setup(org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TFPartialVectorReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TFPartialVectorReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TFPartialVectorReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TFPartialVectorReducer.java Fri Aug 13 18:19:16 2010
@@ -28,6 +28,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Text;
+import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.lucene.analysis.shingle.ShingleFilter;
 import org.apache.lucene.analysis.tokenattributes.TermAttribute;
@@ -55,9 +56,6 @@ public class TFPartialVectorReducer exte
 
   private int maxNGramSize = 1;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void reduce(Text key, Iterable<StringTuple> values, Context context) throws IOException, InterruptedException {
     Iterator<StringTuple> it = values.iterator();
@@ -72,7 +70,7 @@ public class TFPartialVectorReducer exte
       ShingleFilter sf = new ShingleFilter(new IteratorTokenStream(value.getEntries().iterator()), maxNGramSize);
 
       do {
-        String term = ((TermAttribute) sf.getAttribute(TermAttribute.class)).term();
+        String term = (sf.getAttribute(TermAttribute.class)).term();
         if (term.length() > 0) { // ngram
           if (dictionary.containsKey(term)) {
             int termId = dictionary.get(term);
@@ -105,9 +103,6 @@ public class TFPartialVectorReducer exte
     }
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);
@@ -123,7 +118,7 @@ public class TFPartialVectorReducer exte
       Path dictionaryFile = new Path(localFiles[0].getPath());
       FileSystem fs = dictionaryFile.getFileSystem(conf);
       SequenceFile.Reader reader = new SequenceFile.Reader(fs, dictionaryFile, conf);
-      Text key = new Text();
+      Writable key = new Text();
       IntWritable value = new IntWritable();
 
       // key is word value is id

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountMapper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountMapper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountMapper.java Fri Aug 13 18:19:16 2010
@@ -31,9 +31,6 @@ import org.apache.mahout.math.map.OpenOb
  */
 public class TermCountMapper extends Mapper<Text, StringTuple, Text, LongWritable> {
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#map(java.lang.Object, java.lang.Object, org.apache.hadoop.mapreduce.Mapper.Context)
-   */
   @Override
   protected void map(Text key, StringTuple value, final Context context) throws IOException, InterruptedException {
     OpenObjectLongHashMap<String> wordCount = new OpenObjectLongHashMap<String>();

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermCountReducer.java Fri Aug 13 18:19:16 2010
@@ -18,7 +18,6 @@
 package org.apache.mahout.utils.vectors.text.term;
 
 import java.io.IOException;
-import java.util.Iterator;
 
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Text;
@@ -32,24 +31,17 @@ public class TermCountReducer extends Re
 
   private int minSupport;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException {
     long sum = 0;
-    Iterator<LongWritable> it = values.iterator();
-    while (it.hasNext()) {
-      sum += it.next().get();
+    for (LongWritable value : values) {
+      sum += value.get();
     }
     if (sum >= minSupport) {
       context.write(key, new LongWritable(sum));
     }
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountMapper.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountMapper.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountMapper.java Fri Aug 13 18:19:16 2010
@@ -38,9 +38,7 @@ public class TermDocumentCountMapper ext
 
   private static final IntWritable TOTAL_COUNT = new IntWritable(-1);
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Mapper#map(java.lang.Object, java.lang.Object, org.apache.hadoop.mapreduce.Mapper.Context)
-   */
+  @Override
   protected void map(WritableComparable<?> key, VectorWritable value, Context context)
       throws IOException, InterruptedException {
     Vector vector = value.get();

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/text/term/TermDocumentCountReducer.java Fri Aug 13 18:19:16 2010
@@ -18,7 +18,6 @@
 package org.apache.mahout.utils.vectors.text.term;
 
 import java.io.IOException;
-import java.util.Iterator;
 
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.LongWritable;
@@ -29,15 +28,11 @@ import org.apache.hadoop.mapreduce.Reduc
  */
 public class TermDocumentCountReducer extends Reducer<IntWritable, LongWritable, IntWritable, LongWritable> {
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void reduce(IntWritable key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException {
     long sum = 0;
-    Iterator<LongWritable> it = values.iterator();
-    while (it.hasNext()) {
-      sum += it.next().get();
+    for (LongWritable value : values) {
+      sum += value.get();
     }
     context.write(key, new LongWritable(sum));
   }

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFConverter.java Fri Aug 13 18:19:16 2010
@@ -62,7 +62,7 @@ public final class TFIDFConverter {
 
   public static final String MAX_DF_PERCENTAGE = "max.df.percentage";
 
-  public static final String TFIDF_OUTPUT_FOLDER = "tfidf";
+  //public static final String TFIDF_OUTPUT_FOLDER = "tfidf";
 
   private static final String DOCUMENT_VECTOR_OUTPUT_FOLDER = "tfidf-vectors";
 

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFPartialVectorReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFPartialVectorReducer.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFPartialVectorReducer.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/tfidf/TFIDFPartialVectorReducer.java Fri Aug 13 18:19:16 2010
@@ -60,12 +60,9 @@ public class TFIDFPartialVectorReducer e
 
   private boolean sequentialAccess;
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#reduce(java.lang.Object, java.lang.Iterable, org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
-  protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context) throws IOException,
-      InterruptedException {
+  protected void reduce(WritableComparable<?> key, Iterable<VectorWritable> values, Context context)
+      throws IOException, InterruptedException {
     Iterator<VectorWritable> it = values.iterator();
     if (!it.hasNext()) {
       return;
@@ -94,9 +91,6 @@ public class TFIDFPartialVectorReducer e
     context.write(key, vectorWritable);
   }
 
-  /* (non-Javadoc)
-   * @see org.apache.hadoop.mapreduce.Reducer#setup(org.apache.hadoop.mapreduce.Reducer.Context)
-   */
   @Override
   protected void setup(Context context) throws IOException, InterruptedException {
     super.setup(context);

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java Fri Aug 13 18:19:16 2010
@@ -48,12 +48,12 @@ import org.apache.mahout.math.VectorWrit
 
 public class TestCDbwEvaluator extends MahoutTestCase {
 
-  public static final double[][] reference = { { 1, 1 }, { 2, 1 }, { 1, 2 }, { 2, 2 }, { 3, 3 },
+  private static final double[][] reference = { { 1, 1 }, { 2, 1 }, { 1, 2 }, { 2, 2 }, { 3, 3 },
       { 4, 4 }, { 5, 4 }, { 4, 5 }, { 5, 5 } };
 
   private Map<Integer, List<VectorWritable>> representativePoints;
 
-  Map<Integer, Cluster> clusters;
+  private Map<Integer, Cluster> clusters;
 
   @Override
   protected void setUp() throws Exception {
@@ -100,7 +100,7 @@ public class TestCDbwEvaluator extends M
     clusters.put(7, new Canopy(new DenseVector(new double[] { dC, -dC }), 7));
     representativePoints = new HashMap<Integer, List<VectorWritable>>();
     for (Cluster cluster : clusters.values()) {
-      ArrayList<VectorWritable> points = new ArrayList<VectorWritable>();
+      List<VectorWritable> points = new ArrayList<VectorWritable>();
       representativePoints.put(cluster.getId(), points);
       points.add(new VectorWritable(cluster.getCenter().clone()));
       points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[] { dP, dP }))));

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java Fri Aug 13 18:19:16 2010
@@ -54,7 +54,6 @@ public class TestL1ModelClustering exten
   private class MapElement implements Comparable<MapElement> {
     
     MapElement(double pdf, String doc) {
-      super();
       this.pdf = pdf;
       this.doc = doc;
     }

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocMapperTest.java Fri Aug 13 18:19:16 2010
@@ -39,13 +39,12 @@ import org.junit.Test;
 /**
  * Test for CollocMapper 
  */
-@SuppressWarnings("deprecation")
 public class CollocMapperTest {
   
   private Mapper<Text,StringTuple,GramKey,Gram>.Context context;
   private Counter counter;
+
   @Before
-  @SuppressWarnings("unchecked")
   public void setUp() {
     counter = EasyMock.createMock(Counter.class);
     context = EasyMock.createMock(Context.class);

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/CollocReducerTest.java Fri Aug 13 18:19:16 2010
@@ -23,8 +23,8 @@ import static org.apache.mahout.utils.nl
 import static org.apache.mahout.utils.nlp.collocations.llr.Gram.Type.UNIGRAM;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.LinkedList;
-import java.util.List;
 
 import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.hadoop.mapreduce.Reducer.Context;
@@ -38,9 +38,8 @@ import org.junit.Test;
 public class CollocReducerTest {
   
   private Reducer<GramKey,Gram,Gram,Gram>.Context context;
-;  
+
   @Before
-  @SuppressWarnings("unchecked")
   public void setUp() {
     context = EasyMock.createMock(Context.class);
   }
@@ -78,7 +77,7 @@ public class CollocReducerTest {
     for (Gram[] ii : input) {
       key.set(ii[0], empty);
 
-      List<Gram> vv = new LinkedList<Gram>();
+      Collection<Gram> vv = new LinkedList<Gram>();
       vv.addAll(Arrays.asList(ii));
       c.reduce(key, vv, context);
     }

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramKeyPartitionerTest.java Fri Aug 13 18:19:16 2010
@@ -19,6 +19,7 @@ package org.apache.mahout.utils.nlp.coll
 
 import junit.framework.Assert;
 
+import org.apache.hadoop.mapreduce.Partitioner;
 import org.junit.Test;
 
 
@@ -38,7 +39,7 @@ public class GramKeyPartitionerTest {
     GramKey d = new GramKey(new Gram("foo", 1, Gram.Type.TAIL), empty);
     GramKey e = new GramKey(new Gram("foo", 2, Gram.Type.TAIL), foo);
     
-    GramKeyPartitioner p = new GramKeyPartitioner();
+    Partitioner<GramKey, Gram> p = new GramKeyPartitioner();
     int numPartitions = 5;
     
     int ap = p.getPartition(a, null, numPartitions);

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/GramTest.java Fri Aug 13 18:19:16 2010
@@ -19,7 +19,9 @@ package org.apache.mahout.utils.nlp.coll
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.DataInput;
 import java.io.DataInputStream;
+import java.io.DataOutput;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.Arrays;
@@ -57,8 +59,7 @@ public class GramTest {
     try {
       new Gram(null, 4, Gram.Type.UNIGRAM);
       Assert.fail("expected exception");
-    }
-    catch (NullPointerException ex) {
+    } catch (NullPointerException ex) {
       /* ok */
     }
    
@@ -66,8 +67,7 @@ public class GramTest {
     try {
       new Gram("foo", 4, null);
       Assert.fail("expected exception");
-    }
-    catch (NullPointerException ex) {
+    } catch (NullPointerException ex) {
       /* ok */
     }
   }
@@ -173,14 +173,14 @@ public class GramTest {
    Assert.assertEquals(Gram.Type.UNIGRAM, two.getType());
    
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
-   DataOutputStream out = new DataOutputStream(bout);
+   DataOutput out = new DataOutputStream(bout);
    
    two.write(out);
    
    byte[] b = bout.toByteArray();
    
    ByteArrayInputStream bin = new ByteArrayInputStream(b);
-   DataInputStream din = new DataInputStream(bin);
+   DataInput din = new DataInputStream(bin);
    
    one.readFields(din);
 

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/nlp/collocations/llr/LLRReducerTest.java Fri Aug 13 18:19:16 2010
@@ -22,15 +22,13 @@ import static org.apache.mahout.utils.nl
 import static org.apache.mahout.utils.nlp.collocations.llr.Gram.Type.TAIL;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.LinkedList;
-import java.util.List;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.DoubleWritable;
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.hadoop.mapreduce.Reducer;
-import org.apache.hadoop.mapreduce.Reducer.Context;
 import org.apache.mahout.math.stats.LogLikelihood;
 import org.apache.mahout.utils.nlp.collocations.llr.LLRReducer.LLCallback;
 import org.easymock.classextension.EasyMock;
@@ -52,7 +50,6 @@ public class LLRReducerTest {
   private LLCallback cl;
   
   @Before
-  @SuppressWarnings("unchecked")
   public void setUp() {
     context   = EasyMock.createMock(Reducer.Context.class);
     ll        = EasyMock.createMock(LLCallback.class);
@@ -109,7 +106,7 @@ public class LLRReducerTest {
     reducer.setup(context);
     
     for (Gram[] ii: input) {
-      List<Gram> vv = new LinkedList<Gram>();
+      Collection<Gram> vv = new LinkedList<Gram>();
       vv.addAll(Arrays.asList(ii).subList(1, ii.length));
       reducer.reduce(ii[0], vv, context);
     }

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/SequenceFileVectorIterableTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/SequenceFileVectorIterableTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/SequenceFileVectorIterableTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/SequenceFileVectorIterableTest.java Fri Aug 13 18:19:16 2010
@@ -60,12 +60,12 @@ public class SequenceFileVectorIterableT
     FileSystem fs = FileSystem.get(conf);
     SequenceFile.Writer seqWriter = new SequenceFile.Writer(fs, conf, path, LongWritable.class, VectorWritable.class);
     SequenceFileVectorWriter writer = new SequenceFileVectorWriter(seqWriter);
-    RandomVectorIterable iter = new RandomVectorIterable(50);
+    Iterable<Vector> iter = new RandomVectorIterable(50);
     writer.write(iter);
     writer.close();
     
     SequenceFile.Reader seqReader = new SequenceFile.Reader(fs, path, conf);
-    SequenceFileVectorIterable sfvi = new SequenceFileVectorIterable(seqReader);
+    Iterable<Vector> sfvi = new SequenceFileVectorIterable(seqReader);
     int count = 0;
     for (Vector vector : sfvi) {
       //System.out.println("Vec: " + vector.asFormatString());

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/arff/ARFFVectorIterableTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/arff/ARFFVectorIterableTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/arff/ARFFVectorIterableTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/arff/ARFFVectorIterableTest.java Fri Aug 13 18:19:16 2010
@@ -74,7 +74,7 @@ public class ARFFVectorIterableTest exte
   
   public void testDense() throws Exception {
     ARFFModel model = new MapBackedARFFModel();
-    ARFFVectorIterable iterable = new ARFFVectorIterable(SAMPLE_DENSE_ARFF, model);
+    Iterable<Vector> iterable = new ARFFVectorIterable(SAMPLE_DENSE_ARFF, model);
     int count = 0;
     for (Vector vector : iterable) {
       Assert.assertTrue("Vector is not dense", vector instanceof DenseVector);
@@ -85,7 +85,7 @@ public class ARFFVectorIterableTest exte
   
   public void testSparse() throws Exception {
     ARFFModel model = new MapBackedARFFModel();
-    ARFFVectorIterable iterable = new ARFFVectorIterable(SAMPLE_SPARSE_ARFF, model);
+    Iterable<Vector> iterable = new ARFFVectorIterable(SAMPLE_SPARSE_ARFF, model);
     int count = 0;
     for (Vector vector : iterable) {
       Assert.assertTrue("Vector is not dense", vector instanceof RandomAccessSparseVector);

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/io/VectorWriterTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/io/VectorWriterTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/io/VectorWriterTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/io/VectorWriterTest.java Fri Aug 13 18:19:16 2010
@@ -20,6 +20,7 @@ package org.apache.mahout.utils.vectors.
 import java.io.File;
 import java.io.StringWriter;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import junit.framework.Assert;
@@ -29,6 +30,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.SequenceFile;
+import org.apache.hadoop.io.Writable;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.math.DenseVector;
 import org.apache.mahout.math.Vector;
@@ -64,13 +66,13 @@ public class VectorWriterTest extends Ma
     FileSystem fs = FileSystem.get(conf);
     SequenceFile.Writer seqWriter = new SequenceFile.Writer(fs, conf, path, LongWritable.class, VectorWritable.class);
     SequenceFileVectorWriter writer = new SequenceFileVectorWriter(seqWriter);
-    RandomVectorIterable iter = new RandomVectorIterable(50);
+    Iterable<Vector> iter = new RandomVectorIterable(50);
     writer.write(iter);
     writer.close();
     
     SequenceFile.Reader seqReader = new SequenceFile.Reader(fs, path, conf);
-    LongWritable key = new LongWritable();
-    VectorWritable value = new VectorWritable();
+    Writable key = new LongWritable();
+    Writable value = new VectorWritable();
     int count = 0;
     while (seqReader.next(key, value)){
       count++;
@@ -81,7 +83,7 @@ public class VectorWriterTest extends Ma
   public void test() throws Exception {
     StringWriter strWriter = new StringWriter();
     VectorWriter writer = new JWriterVectorWriter(strWriter);
-    List<Vector> vectors = new ArrayList<Vector>();
+    Collection<Vector> vectors = new ArrayList<Vector>();
     vectors.add(new DenseVector(new double[]{0.3, 1.5, 4.5}));
     vectors.add(new DenseVector(new double[]{1.3, 1.5, 3.5}));
     writer.write(vectors);

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java Fri Aug 13 18:19:16 2010
@@ -68,8 +68,7 @@ public class LuceneIterableTest extends 
     Weight weight = new TFIDF();
     TermInfo termInfo = new CachedTermInfo(reader, "content", 1, 100);
     VectorMapper mapper = new TFDFMapper(reader, weight, termInfo);
-    LuceneIterable iterable;
-    iterable = new LuceneIterable(reader, "id", "content", mapper);
+    LuceneIterable iterable = new LuceneIterable(reader, "id", "content", mapper);
 
     //TODO: do something more meaningful here
     for (Vector vector : iterable) {

Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizerTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizerTest.java?rev=985313&r1=985312&r2=985313&view=diff
==============================================================================
--- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizerTest.java (original)
+++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/text/DictionaryVectorizerTest.java Fri Aug 13 18:19:16 2010
@@ -36,19 +36,19 @@ import org.apache.mahout.utils.vectors.t
  */
 public class DictionaryVectorizerTest extends MahoutTestCase {
 
-  public static final int AVG_DOCUMENT_LENGTH = 20;
+  private static final int AVG_DOCUMENT_LENGTH = 20;
 
-  public static final int AVG_SENTENCE_LENGTH = 8;
+  private static final int AVG_SENTENCE_LENGTH = 8;
 
-  public static final int AVG_WORD_LENGTH = 6;
+  private static final int AVG_WORD_LENGTH = 6;
 
-  public static final int NUM_DOCS = 100;
+  private static final int NUM_DOCS = 100;
 
-  public static final String CHARSET = "abcdef";
+  private static final String CHARSET = "abcdef";
 
-  public static final String DELIM = " .,?;:!\t\n\r";
+  private static final String DELIM = " .,?;:!\t\n\r";
 
-  public static final String ERRORSET = "`1234567890" + "-=~@#$%^&*()_+[]{}'\"/<>|\\";
+  private static final String ERRORSET = "`1234567890" + "-=~@#$%^&*()_+[]{}'\"/<>|\\";
 
   private static final Random random = RandomUtils.getRandom();
 
@@ -58,7 +58,7 @@ public class DictionaryVectorizerTest ex
     return DELIM.charAt(random.nextInt(DictionaryVectorizerTest.DELIM.length()));
   }
 
-  public static String getRandomDocument() {
+  private static String getRandomDocument() {
     int length = (AVG_DOCUMENT_LENGTH >> 1) + DictionaryVectorizerTest.random.nextInt(AVG_DOCUMENT_LENGTH);
     StringBuilder sb = new StringBuilder(length * AVG_SENTENCE_LENGTH * AVG_WORD_LENGTH);
     for (int i = 0; i < length; i++) {
@@ -67,7 +67,7 @@ public class DictionaryVectorizerTest ex
     return sb.toString();
   }
 
-  public static String getRandomSentence() {
+  private static String getRandomSentence() {
     int length = (AVG_SENTENCE_LENGTH >> 1) + DictionaryVectorizerTest.random.nextInt(AVG_SENTENCE_LENGTH);
     StringBuilder sb = new StringBuilder(length * AVG_WORD_LENGTH);
     for (int i = 0; i < length; i++) {
@@ -77,7 +77,7 @@ public class DictionaryVectorizerTest ex
     return sb.toString();
   }
 
-  public static String getRandomString() {
+  private static String getRandomString() {
     int length = (AVG_WORD_LENGTH >> 1) + DictionaryVectorizerTest.random.nextInt(AVG_WORD_LENGTH);
     StringBuilder sb = new StringBuilder(length);
     for (int i = 0; i < length; i++) {