| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OptimizeTask.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OptimizeTask.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/OptimizeTask.java (working copy) |
| @@ -41,7 +41,7 @@ |
| |
| public void setParams(String params) { |
| super.setParams(params); |
| - maxNumSegments = (int) Double.valueOf(params).intValue(); |
| + maxNumSegments = Double.valueOf(params).intValue(); |
| } |
| |
| public boolean supportsParams() { |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersQueryMaker.java (working copy) |
| @@ -71,9 +71,9 @@ |
| * @param a analyzer to use when parsing queries |
| * @return array of Lucene queries |
| */ |
| - private static Query[] createQueries(List qs, Analyzer a) { |
| + private static Query[] createQueries(List<Object> qs, Analyzer a) { |
| QueryParser qp = new QueryParser(DocMaker.BODY_FIELD, a); |
| - List queries = new ArrayList(); |
| + List<Object> queries = new ArrayList<Object>(); |
| for (int i = 0; i < qs.size(); i++) { |
| try { |
| |
| @@ -98,7 +98,7 @@ |
| } |
| } |
| |
| - return (Query[]) queries.toArray(new Query[0]); |
| + return queries.toArray(new Query[0]); |
| } |
| |
| protected Query[] prepareQueries() throws Exception { |
| @@ -106,7 +106,7 @@ |
| Analyzer anlzr= NewAnalyzerTask.createAnalyzer(config.get("analyzer", |
| "org.apache.lucene.analysis.standard.StandardAnalyzer")); |
| |
| - List queryList = new ArrayList(20); |
| + List<Object> queryList = new ArrayList<Object>(20); |
| queryList.addAll(Arrays.asList(STANDARD_QUERIES)); |
| queryList.addAll(Arrays.asList(getPrebuiltQueries(DocMaker.BODY_FIELD))); |
| return createQueries(queryList, anlzr); |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleQueryMaker.java (working copy) |
| @@ -47,7 +47,7 @@ |
| "org.apache.lucene.analysis.standard.StandardAnalyzer")); |
| |
| QueryParser qp = new QueryParser(DocMaker.BODY_FIELD,anlzr); |
| - ArrayList qq = new ArrayList(); |
| + ArrayList<Query> qq = new ArrayList<Query>(); |
| Query q1 = new TermQuery(new Term(DocMaker.ID_FIELD,"doc2")); |
| qq.add(q1); |
| Query q2 = new TermQuery(new Term(DocMaker.BODY_FIELD,"simple")); |
| @@ -63,7 +63,7 @@ |
| qq.add(qp.parse("\"synthetic text\"~3")); |
| qq.add(qp.parse("zoom*")); |
| qq.add(qp.parse("synth*")); |
| - return (Query []) qq.toArray(new Query[0]); |
| + return qq.toArray(new Query[0]); |
| } |
| |
| } |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiContentSource.java (working copy) |
| @@ -220,7 +220,7 @@ |
| } |
| } |
| |
| - private static final Map ELEMENTS = new HashMap(); |
| + private static final Map<String,Integer> ELEMENTS = new HashMap<String,Integer>(); |
| private static final int TITLE = 0; |
| private static final int DATE = TITLE + 1; |
| private static final int BODY = DATE + 1; |
| @@ -248,7 +248,7 @@ |
| * the element qualified name over and over. |
| */ |
| private final static int getElementType(String elem) { |
| - Integer val = (Integer) ELEMENTS.get(elem); |
| + Integer val = ELEMENTS.get(elem); |
| return val == null ? -1 : val.intValue(); |
| } |
| |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java (working copy) |
| @@ -47,9 +47,9 @@ |
| ParsePosition pos; |
| } |
| |
| - private ThreadLocal dateFormat = new ThreadLocal(); |
| + private ThreadLocal<DateFormatInfo> dateFormat = new ThreadLocal<DateFormatInfo>(); |
| private File dataDir = null; |
| - private ArrayList inputFiles = new ArrayList(); |
| + private ArrayList<File> inputFiles = new ArrayList<File>(); |
| private int nextFile = 0; |
| private int iteration = 0; |
| |
| @@ -69,7 +69,7 @@ |
| } |
| |
| private synchronized DateFormatInfo getDateFormatInfo() { |
| - DateFormatInfo dfi = (DateFormatInfo) dateFormat.get(); |
| + DateFormatInfo dfi = dateFormat.get(); |
| if (dfi == null) { |
| dfi = new DateFormatInfo(); |
| // date format: 30-MAR-1987 14:22:36.87 |
| @@ -105,7 +105,7 @@ |
| nextFile = 0; |
| iteration++; |
| } |
| - f = (File) inputFiles.get(nextFile++); |
| + f = inputFiles.get(nextFile++); |
| name = f.getCanonicalPath() + "_" + iteration; |
| } |
| |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleSloppyPhraseQueryMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleSloppyPhraseQueryMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/SimpleSloppyPhraseQueryMaker.java (working copy) |
| @@ -35,15 +35,15 @@ |
| protected Query[] prepareQueries() throws Exception { |
| // extract some 100 words from doc text to an array |
| String words[]; |
| - ArrayList w = new ArrayList(); |
| + ArrayList<String> w = new ArrayList<String>(); |
| StringTokenizer st = new StringTokenizer(SingleDocSource.DOC_TEXT); |
| while (st.hasMoreTokens() && w.size()<100) { |
| w.add(st.nextToken()); |
| } |
| - words = (String[]) w.toArray(new String[0]); |
| + words = w.toArray(new String[0]); |
| |
| // create queries (that would find stuff) with varying slops |
| - ArrayList queries = new ArrayList(); |
| + ArrayList<Query> queries = new ArrayList<Query>(); |
| for (int slop=0; slop<8; slop++) { |
| for (int qlen=2; qlen<6; qlen++) { |
| for (int wd=0; wd<words.length-qlen-slop; wd++) { |
| @@ -76,7 +76,7 @@ |
| } |
| } |
| } |
| - return (Query[]) queries.toArray(new Query[0]); |
| + return queries.toArray(new Query[0]); |
| } |
| |
| } |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/TrecContentSource.java (working copy) |
| @@ -76,11 +76,11 @@ |
| "EEE MMM dd kk:mm:ss yyyy", // Tue Dec 09 16:45:08 2003 |
| }; |
| |
| - private ThreadLocal dateFormats = new ThreadLocal(); |
| - private ThreadLocal trecDocReader = new ThreadLocal(); |
| - private ThreadLocal trecDocBuffer = new ThreadLocal(); |
| + private ThreadLocal<DateFormatInfo> dateFormats = new ThreadLocal<DateFormatInfo>(); |
| + private ThreadLocal<StringBufferReader> trecDocReader = new ThreadLocal<StringBufferReader>(); |
| + private ThreadLocal<StringBuffer> trecDocBuffer = new ThreadLocal<StringBuffer>(); |
| private File dataDir = null; |
| - private ArrayList inputFiles = new ArrayList(); |
| + private ArrayList<File> inputFiles = new ArrayList<File>(); |
| private int nextFile = 0; |
| private int rawDocSize; |
| |
| @@ -93,7 +93,7 @@ |
| HTMLParser htmlParser; |
| |
| private DateFormatInfo getDateFormatInfo() { |
| - DateFormatInfo dfi = (DateFormatInfo) dateFormats.get(); |
| + DateFormatInfo dfi = dateFormats.get(); |
| if (dfi == null) { |
| dfi = new DateFormatInfo(); |
| dfi.dfs = new SimpleDateFormat[DATE_FORMATS.length]; |
| @@ -108,7 +108,7 @@ |
| } |
| |
| private StringBuffer getDocBuffer() { |
| - StringBuffer sb = (StringBuffer) trecDocBuffer.get(); |
| + StringBuffer sb = trecDocBuffer.get(); |
| if (sb == null) { |
| sb = new StringBuffer(); |
| trecDocBuffer.set(sb); |
| @@ -117,7 +117,7 @@ |
| } |
| |
| private Reader getTrecDocReader(StringBuffer docBuffer) { |
| - StringBufferReader r = (StringBufferReader) trecDocReader.get(); |
| + StringBufferReader r = trecDocReader.get(); |
| if (r == null) { |
| r = new StringBufferReader(docBuffer); |
| trecDocReader.set(r); |
| @@ -177,7 +177,7 @@ |
| nextFile = 0; |
| iteration++; |
| } |
| - File f = (File) inputFiles.get(nextFile++); |
| + File f = inputFiles.get(nextFile++); |
| if (verbose) { |
| System.out.println("opening: " + f + " length: " + f.length()); |
| } |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java (working copy) |
| @@ -50,7 +50,7 @@ |
| String defaultField = config.get("file.query.maker.default.field", DocMaker.BODY_FIELD); |
| QueryParser qp = new QueryParser(defaultField, anlzr); |
| |
| - List qq = new ArrayList(); |
| + List<Query> qq = new ArrayList<Query>(); |
| String fileName = config.get("file.query.maker.file", null); |
| if (fileName != null) |
| { |
| @@ -93,7 +93,6 @@ |
| } |
| |
| } |
| - Query [] result = (Query[]) qq.toArray(new Query[qq.size()]) ; |
| - return result; |
| + return qq.toArray(new Query[qq.size()]) ; |
| } |
| } |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (working copy) |
| @@ -20,10 +20,8 @@ |
| import java.io.IOException; |
| import java.io.UnsupportedEncodingException; |
| import java.util.HashMap; |
| -import java.util.Iterator; |
| import java.util.Map; |
| import java.util.Properties; |
| -import java.util.Map.Entry; |
| import java.util.Random; |
| |
| import org.apache.lucene.benchmark.byTask.utils.Config; |
| @@ -79,7 +77,7 @@ |
| |
| static class DocState { |
| |
| - private final Map fields; |
| + private final Map<String,Field> fields; |
| private final boolean reuseFields; |
| final Document doc; |
| DocData docData = new DocData(); |
| @@ -89,7 +87,7 @@ |
| this.reuseFields = reuseFields; |
| |
| if (reuseFields) { |
| - fields = new HashMap(); |
| + fields = new HashMap<String,Field>(); |
| |
| // Initialize the map with the default fields. |
| fields.put(BODY_FIELD, new Field(BODY_FIELD, "", store, bodyIndex, termVector)); |
| @@ -115,7 +113,7 @@ |
| return new Field(name, "", store, index, termVector); |
| } |
| |
| - Field f = (Field) fields.get(name); |
| + Field f = fields.get(name); |
| if (f == null) { |
| f = new Field(name, "", store, index, termVector); |
| fields.put(name, f); |
| @@ -128,8 +126,8 @@ |
| private boolean storeBytes = false; |
| |
| // leftovers are thread local, because it is unsafe to share residues between threads |
| - private ThreadLocal leftovr = new ThreadLocal(); |
| - private ThreadLocal docState = new ThreadLocal(); |
| + private ThreadLocal<LeftOver> leftovr = new ThreadLocal<LeftOver>(); |
| + private ThreadLocal<DocState> docState = new ThreadLocal<DocState>(); |
| |
| public static final String BODY_FIELD = "body"; |
| public static final String TITLE_FIELD = "doctitle"; |
| @@ -224,8 +222,7 @@ |
| if (indexProperties) { |
| Properties props = docData.getProps(); |
| if (props != null) { |
| - for (Iterator iterator = props.entrySet().iterator(); iterator.hasNext();) { |
| - Entry entry = (Entry) iterator.next(); |
| + for (final Map.Entry<Object,Object> entry : props.entrySet()) { |
| Field f = ds.getField((String) entry.getKey(), storeVal, indexVal, termVecVal); |
| f.setValue((String) entry.getValue()); |
| doc.add(f); |
| @@ -243,7 +240,7 @@ |
| } |
| |
| protected DocState getDocState() { |
| - DocState ds = (DocState) docState.get(); |
| + DocState ds = docState.get(); |
| if (ds == null) { |
| ds = new DocState(true, storeVal, indexVal, bodyIndexVal, termVecVal); |
| docState.set(ds); |
| @@ -299,7 +296,7 @@ |
| * given size input by <code>size</code>. |
| */ |
| public Document makeDocument(int size) throws Exception { |
| - LeftOver lvr = (LeftOver) leftovr.get(); |
| + LeftOver lvr = leftovr.get(); |
| if (lvr == null || lvr.docdata == null || lvr.docdata.getBody() == null |
| || lvr.docdata.getBody().length() == 0) { |
| resetLeftovers(); |
| @@ -413,7 +410,7 @@ |
| // In a multi-rounds run, it is important to reset DocState since settings |
| // of fields may change between rounds, and this is the only way to reset |
| // the cache of all threads. |
| - docState = new ThreadLocal(); |
| + docState = new ThreadLocal<DocState>(); |
| } |
| |
| indexProperties = config.get("doc.index.props", false); |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DirContentSource.java (working copy) |
| @@ -51,13 +51,12 @@ |
| ParsePosition pos; |
| } |
| |
| - public static class Iterator implements java.util.Iterator { |
| + public static class Iterator implements java.util.Iterator<File> { |
| |
| - static class Comparator implements java.util.Comparator { |
| - public int compare(Object _a, Object _b) { |
| + static class Comparator implements java.util.Comparator<File> { |
| + public int compare(File _a, File _b) { |
| String a = _a.toString(); |
| String b = _b.toString(); |
| - |
| int diff = a.length() - b.length(); |
| |
| if (diff > 0) { |
| @@ -79,7 +78,7 @@ |
| |
| int count = 0; |
| |
| - Stack stack = new Stack(); |
| + Stack<File> stack = new Stack<File>(); |
| |
| /* this seems silly ... there must be a better way ... |
| not that this is good, but can it matter? */ |
| @@ -94,10 +93,10 @@ |
| if (stack.empty()) { |
| return; |
| } |
| - if (!((File)stack.peek()).isDirectory()) { |
| + if (!(stack.peek()).isDirectory()) { |
| return; |
| } |
| - File f = (File)stack.pop(); |
| + File f = stack.pop(); |
| push(f); |
| } |
| |
| @@ -133,10 +132,10 @@ |
| return stack.size() > 0; |
| } |
| |
| - public Object next() { |
| + public File next() { |
| assert hasNext(); |
| count++; |
| - Object object = stack.pop(); |
| + File object = stack.pop(); |
| // System.err.println("pop " + object); |
| find(); |
| return object; |
| @@ -148,7 +147,7 @@ |
| |
| } |
| |
| - private ThreadLocal dateFormat = new ThreadLocal(); |
| + private ThreadLocal<DateFormatInfo> dateFormat = new ThreadLocal<DateFormatInfo>(); |
| private File dataDir = null; |
| private int iteration = 0; |
| private Iterator inputFiles = null; |
| @@ -156,7 +155,7 @@ |
| // get/initiate a thread-local simple date format (must do so |
| // because SimpleDateFormat is not thread-safe). |
| private DateFormatInfo getDateFormatInfo() { |
| - DateFormatInfo dfi = (DateFormatInfo) dateFormat.get(); |
| + DateFormatInfo dfi = dateFormat.get(); |
| if (dfi == null) { |
| dfi = new DateFormatInfo(); |
| dfi.pos = new ParsePosition(0); |
| @@ -191,7 +190,7 @@ |
| inputFiles = new Iterator(dataDir); |
| iteration++; |
| } |
| - f = (File) inputFiles.next(); |
| + f = inputFiles.next(); |
| // System.err.println(f); |
| name = f.getCanonicalPath()+"_"+iteration; |
| } |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentSource.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentSource.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentSource.java (working copy) |
| @@ -57,7 +57,7 @@ |
| |
| private static final int BZIP = 0; |
| private static final int OTHER = 1; |
| - private static final Map extensionToType = new HashMap(); |
| + private static final Map<String,Integer> extensionToType = new HashMap<String,Integer>(); |
| static { |
| extensionToType.put(".bz2", Integer.valueOf(BZIP)); |
| extensionToType.put(".bzip", Integer.valueOf(BZIP)); |
| @@ -93,7 +93,7 @@ |
| * a given directory. The collected {@link File} instances are stored in the |
| * given <code>files</code>. |
| */ |
| - protected final void collectFiles(File dir, ArrayList files) { |
| + protected final void collectFiles(File dir, ArrayList<File> files) { |
| if (!dir.canRead()) { |
| return; |
| } |
| @@ -125,7 +125,7 @@ |
| int idx = fileName.lastIndexOf('.'); |
| int type = OTHER; |
| if (idx != -1) { |
| - Integer typeInt = (Integer) extensionToType.get(fileName.substring(idx)); |
| + Integer typeInt = extensionToType.get(fileName.substring(idx)); |
| if (typeInt != null) { |
| type = typeInt.intValue(); |
| } |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiQueryMaker.java (working copy) |
| @@ -91,9 +91,9 @@ |
| * @param a analyzer to use when parsing queries |
| * @return array of Lucene queries |
| */ |
| - private static Query[] createQueries(List qs, Analyzer a) { |
| + private static Query[] createQueries(List<Object> qs, Analyzer a) { |
| QueryParser qp = new QueryParser(DocMaker.BODY_FIELD, a); |
| - List queries = new ArrayList(); |
| + List<Object> queries = new ArrayList<Object>(); |
| for (int i = 0; i < qs.size(); i++) { |
| try { |
| |
| @@ -118,14 +118,14 @@ |
| } |
| } |
| |
| - return (Query[]) queries.toArray(new Query[0]); |
| + return queries.toArray(new Query[0]); |
| } |
| |
| protected Query[] prepareQueries() throws Exception { |
| // analyzer (default is standard analyzer) |
| Analyzer anlzr = NewAnalyzerTask.createAnalyzer(config.get("analyzer", StandardAnalyzer.class.getName())); |
| |
| - List queryList = new ArrayList(20); |
| + List<Object> queryList = new ArrayList<Object>(20); |
| queryList.addAll(Arrays.asList(STANDARD_QUERIES)); |
| if(!config.get("enwikiQueryMaker.disableSpanQueries", false)) |
| queryList.addAll(Arrays.asList(getPrebuiltQueries(DocMaker.BODY_FIELD))); |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/EnwikiDocMaker.java (working copy) |
| @@ -18,11 +18,6 @@ |
| */ |
| |
| import org.apache.lucene.benchmark.byTask.utils.Config; |
| -import org.apache.lucene.document.Document; |
| -import org.apache.lucene.document.Field; |
| -import org.apache.lucene.document.Field.Index; |
| -import org.apache.lucene.document.Field.Store; |
| -import org.apache.lucene.document.Field.TermVector; |
| |
| /** |
| * A {@link DocMaker} which reads the English Wikipedia dump. Uses |
| Index: contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java |
| =================================================================== |
| --- contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java (revision 829090) |
| +++ contrib/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java (working copy) |
| @@ -20,7 +20,6 @@ |
| import java.io.File; |
| import java.io.IOException; |
| import java.util.HashMap; |
| -import java.util.Iterator; |
| |
| import org.apache.lucene.analysis.Analyzer; |
| import org.apache.lucene.benchmark.byTask.feeds.DocMaker; |
| @@ -64,8 +63,8 @@ |
| private DocMaker docMaker; |
| |
| // we use separate (identical) instances for each "read" task type, so each can iterate the quries separately. |
| - private HashMap readTaskQueryMaker; |
| - private Class qmkrClass; |
| + private HashMap<Class<? extends ReadTask>,QueryMaker> readTaskQueryMaker; |
| + private Class<? extends QueryMaker> qmkrClass; |
| |
| private IndexReader indexReader; |
| private IndexSearcher indexSearcher; |
| @@ -84,8 +83,8 @@ |
| "org.apache.lucene.benchmark.byTask.feeds.DocMaker")).newInstance(); |
| docMaker.setConfig(config); |
| // query makers |
| - readTaskQueryMaker = new HashMap(); |
| - qmkrClass = Class.forName(config.get("query.maker","org.apache.lucene.benchmark.byTask.feeds.SimpleQueryMaker")); |
| + readTaskQueryMaker = new HashMap<Class<? extends ReadTask>,QueryMaker>(); |
| + qmkrClass = (Class<? extends QueryMaker>) Class.forName(config.get("query.maker","org.apache.lucene.benchmark.byTask.feeds.SimpleQueryMaker")); |
| |
| // index stuff |
| reinit(false); |
| @@ -239,9 +238,8 @@ |
| |
| public void resetInputs() throws IOException { |
| docMaker.resetInputs(); |
| - Iterator it = readTaskQueryMaker.values().iterator(); |
| - while (it.hasNext()) { |
| - ((QueryMaker) it.next()).resetInputs(); |
| + for (final QueryMaker queryMaker : readTaskQueryMaker.values()) { |
| + queryMaker.resetInputs(); |
| } |
| } |
| |
| @@ -251,11 +249,11 @@ |
| synchronized public QueryMaker getQueryMaker(ReadTask readTask) { |
| // mapping the query maker by task class allows extending/adding new search/read tasks |
| // without needing to modify this class. |
| - Class readTaskClass = readTask.getClass(); |
| - QueryMaker qm = (QueryMaker) readTaskQueryMaker.get(readTaskClass); |
| + Class<? extends ReadTask> readTaskClass = readTask.getClass(); |
| + QueryMaker qm = readTaskQueryMaker.get(readTaskClass); |
| if (qm == null) { |
| try { |
| - qm = (QueryMaker) qmkrClass.newInstance(); |
| + qm = qmkrClass.newInstance(); |
| qm.setConfig(config); |
| } catch (Exception e) { |
| throw new RuntimeException(e); |