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 2008/08/02 05:56:27 UTC
svn commit: r681936 - in /lucene/mahout/trunk/core/src:
main/examples/org/apache/mahout/ga/watchmaker/cd/
main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/
main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/
main/java/org/apache/ma...
Author: srowen
Date: Fri Aug 1 20:56:26 2008
New Revision: 681936
URL: http://svn.apache.org/viewvc?rev=681936&view=rev
Log:
Make sure equals()/hashCode() are paired and a bunch of small cleanups from IntelliJ
Modified:
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFactory.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitness.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDMutation.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDRule.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataLine.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataSet.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplit.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java
lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/Pair.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/MahoutEvaluator.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/StringUtils.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/StringUtilsTest.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/utils/StringUtilsTest.java
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFactory.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFactory.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFactory.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFactory.java Fri Aug 1 20:56:26 2008
@@ -26,7 +26,7 @@
*/
public class CDFactory extends AbstractCandidateFactory<CDRule> {
- private double threshold;
+ private final double threshold;
/**
*
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitness.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitness.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitness.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitness.java Fri Aug 1 20:56:26 2008
@@ -94,6 +94,11 @@
}
@Override
+ public int hashCode() {
+ return tp + 31 * (fp + 31 * (tn + 31 * fn));
+ }
+
+ @Override
public String toString() {
return "[TP=" + tp + ", FP=" + fp + ", TN=" + tn + ", FN=" + fn + "]";
}
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDFitnessEvaluator.java Fri Aug 1 20:56:26 2008
@@ -36,7 +36,7 @@
private final DatasetSplit split;
- private List<CDFitness> evals = new ArrayList<CDFitness>();
+ private final List<CDFitness> evals = new ArrayList<CDFitness>();
/**
*
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDMutation.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDMutation.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDMutation.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDMutation.java Fri Aug 1 20:56:26 2008
@@ -42,13 +42,12 @@
/**
*
- * @param dataset
* @param rate probability of mutating a variable
* @param range max step-size for each variable
* @param k mutation precision
*
* See
- * {@link http://www.geatbx.com/docu/algindex-04.html#P659_42386 real valued mutation}
+ * {@see http://www.geatbx.com/docu/algindex-04.html#P659_42386 real valued mutation}
* for more information about the parameters
*/
public CDMutation(double rate, double range, int k) {
@@ -98,10 +97,6 @@
/**
* returns a random double in the interval [min, max ].
- *
- * @param domain
- * @param rng
- * @return
*/
double rndDouble(double value, double min, double max, Random rng) {
double s = rng.nextDouble() * 2.0 - 1.0; // [-1, +1]
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDRule.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDRule.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDRule.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/CDRule.java Fri Aug 1 20:56:26 2008
@@ -55,8 +55,6 @@
private double[] values;
/**
- *
- * @param nbConditions
* @param threshold condition activation threshold
*/
public CDRule(double threshold) {
@@ -258,6 +256,16 @@
return true;
}
+ @Override
+ public int hashCode() {
+ int value = 0;
+ for (int index = 0; index < nbConditions; index++) {
+ value *= 31;
+ value += Double.doubleToLongBits(getW(index)) + (getO(index) ? 1 : 0) + getV(index);
+ }
+ return value;
+ }
+
/**
* Compares a given gene between two rules
*
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataLine.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataLine.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataLine.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataLine.java Fri Aug 1 20:56:26 2008
@@ -26,7 +26,7 @@
*/
public class DataLine {
- private double[] attributes;
+ private final double[] attributes;
public DataLine() {
int nba = DataSet.getDataSet().getNbAttributes();
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataSet.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataSet.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataSet.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/DataSet.java Fri Aug 1 20:56:26 2008
@@ -50,7 +50,6 @@
/**
* Converts a string value of a nominal attribute to an <code>int</code>.
*
- * @param index of the attribute
* @param value
* @return an <code>int</code> representing the value
* @throws RuntimeException if the value is not found.
@@ -89,11 +88,11 @@
/** Singleton */
private static DataSet dataset;
- private List<Integer> ignoredAttributes;
+ private final List<Integer> ignoredAttributes;
- private int labelIndex;
+ private final int labelIndex;
- private List<Attribute> attributes;
+ private final List<Attribute> attributes;
DataSet(List<Attribute> attributes, List<Integer> ignored, int labelIndex) {
this.attributes = attributes;
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/FileInfoParser.java Fri Aug 1 20:56:26 2008
@@ -59,7 +59,7 @@
* Initializes a dataset using an info file.
*
* @param fs file system
- * @param file info file
+ * @param inpath info file
* @return Initialized Dataset
*/
public static DataSet parseFile(FileSystem fs, Path inpath)
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluator.java Fri Aug 1 20:56:26 2008
@@ -118,7 +118,6 @@
* Configure the job
*
* @param conf
- * @param evaluator FitnessEvaluator passed to the mapper
* @param inpath input <code>Path</code>
* @param outpath output <code>Path</code>
*/
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplit.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplit.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplit.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/cd/hadoop/DatasetSplit.java Fri Aug 1 20:56:26 2008
@@ -43,9 +43,9 @@
static final String TRAINING = "traintest.training";
- private byte[] seed;
+ private final byte[] seed;
- private double threshold;
+ private final double threshold;
private boolean training;
@@ -132,9 +132,9 @@
private boolean training;
- private LongWritable k = new LongWritable();
+ private final LongWritable k = new LongWritable();
- private Text v = new Text();
+ private final Text v = new Text();
public RndLineRecordReader(RecordReader<LongWritable, Text> reader,
JobConf conf) {
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/ItineraryPanel.java Fri Aug 1 20:56:26 2008
@@ -42,8 +42,8 @@
final class ItineraryPanel extends JPanel
{
private final Collection<JCheckBox> checkBoxes;
- private JButton selectAllButton;
- private JButton clearButton;
+ private final JButton selectAllButton;
+ private final JButton clearButton;
public ItineraryPanel(List<String> cities)
{
Modified: lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java (original)
+++ lucene/mahout/trunk/core/src/main/examples/org/apache/mahout/ga/watchmaker/travellingsalesman/StrategyPanel.java Fri Aug 1 20:56:26 2008
@@ -56,10 +56,6 @@
*/
@SuppressWarnings("serial")
final class StrategyPanel extends JPanel {
- private final SelectionStrategy<?>[] selectionStrategies = {
- new RankSelection(), new RouletteWheelSelection(),
- new StochasticUniversalSampling(), new TournamentSelection(0.95d),
- new TruncationSelection(0.5d) };
private final DistanceLookup distances;
@@ -162,6 +158,12 @@
selectionLabel = new JLabel("Selection Strategy: ");
innerPanel.add(selectionLabel);
+
+ SelectionStrategy<?>[] selectionStrategies = {
+ new RankSelection(), new RouletteWheelSelection(),
+ new StochasticUniversalSampling(), new TournamentSelection(0.95d),
+ new TruncationSelection(0.5d)};
+
selectionCombo = new JComboBox(selectionStrategies);
selectionCombo.setRenderer(new DefaultListCellRenderer() {
@Override
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/Pair.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/Pair.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/Pair.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/Pair.java Fri Aug 1 20:56:26 2008
@@ -20,7 +20,7 @@
/**
* A simple (ordered) pair of two objects. Elements may be null.
*/
-public class Pair<A, B> {
+public final class Pair<A, B> {
private final A first;
private final B second;
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java Fri Aug 1 20:56:26 2008
@@ -90,7 +90,7 @@
timer.schedule(new RefreshTimerTask(), RELOAD_CHECK_INTERVAL_MS, RELOAD_CHECK_INTERVAL_MS);
}
- protected void reload() throws IOException {
+ protected void reload() {
try {
reloadLock.lock();
Map<String, List<Preference>> data = new FastMap<String, List<Preference>>();
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/MahoutEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/MahoutEvaluator.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/MahoutEvaluator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/MahoutEvaluator.java Fri Aug 1 20:56:26 2008
@@ -121,7 +121,7 @@
* Stores a population of candidates in the output file path.
*
* @param fs FileSystem used to create the output file
- * @param outFile output file path
+ * @param f output file path
* @param population population to store
* @throws IOException
*/
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/ga/watchmaker/STFitnessEvaluator.java Fri Aug 1 20:56:26 2008
@@ -27,7 +27,7 @@
*/
public abstract class STFitnessEvaluator<T> implements FitnessEvaluator<T> {
- private List<Float> evaluations = new ArrayList<Float>();
+ private final List<Float> evaluations = new ArrayList<Float>();
private List<? extends T> population;
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/StringUtils.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/StringUtils.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/StringUtils.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/StringUtils.java Fri Aug 1 20:56:26 2008
@@ -26,7 +26,7 @@
*/
public class StringUtils {
- private static XStream xstream = new XStream();
+ private static final XStream xstream = new XStream();
/**
* Converts the object to a one-line string representation
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/MahoutEvaluatorTest.java Fri Aug 1 20:56:26 2008
@@ -67,7 +67,7 @@
}
private void storeLoadPopulation(List<DummyCandidate> population)
- throws IOException, ClassNotFoundException {
+ throws IOException {
FileSystem fs = FileSystem.get(new Configuration());
Path f = new Path("build/test.txt");
@@ -87,11 +87,10 @@
}
private void loadPopulation(FileSystem fs, Path f,
- List<DummyCandidate> population) throws IOException,
- ClassNotFoundException {
+ List<DummyCandidate> population) throws IOException {
FSDataInputStream in = fs.open(f);
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
- String s = null;
+ String s;
try {
while ((s = reader.readLine()) != null) {
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/StringUtilsTest.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/StringUtilsTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/StringUtilsTest.java Fri Aug 1 20:56:26 2008
@@ -39,6 +39,11 @@
return field == dt.field;
}
+ @Override
+ public int hashCode() {
+ return field;
+ }
+
}
public void testStringConversion() throws Exception {
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyCandidate.java Fri Aug 1 20:56:26 2008
@@ -20,7 +20,8 @@
import java.util.List;
public class DummyCandidate {
- private int index;
+
+ private final int index;
public int getIndex() {
return index;
@@ -41,6 +42,11 @@
return index == dc.index;
}
+ @Override
+ public int hashCode() {
+ return index;
+ }
+
public static List<DummyCandidate> generatePopulation(int size) {
assert size > 0 : "bad size";
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/ga/watchmaker/utils/DummyEvaluator.java Fri Aug 1 20:56:26 2008
@@ -31,9 +31,10 @@
*/
public class DummyEvaluator implements FitnessEvaluator<DummyCandidate> {
- private Random rng = new Random();
+ private final Random rng = new Random();
+
+ private static final Map<Integer, Float> evaluations = new HashMap<Integer, Float>();
- private static Map<Integer, Float> evaluations = new HashMap<Integer, Float>();
public static Float getFitness(Integer key) {
if (!evaluations.containsKey(key))
throw new RuntimeException("Fitness not found");
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/utils/StringUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/utils/StringUtilsTest.java?rev=681936&r1=681935&r2=681936&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/utils/StringUtilsTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/utils/StringUtilsTest.java Fri Aug 1 20:56:26 2008
@@ -39,6 +39,11 @@
return field == dt.field;
}
+ @Override
+ public int hashCode() {
+ return field;
+ }
+
}
public void testStringConversion() throws Exception {