Revision: 14499
http://gate.svn.sourceforge.net/gate/?rev=14499&view=rev
Author: markagreenwood
Date: 2011-11-05 12:24:12 +0000 (Sat, 05 Nov 2011)
Log Message:
-----------
strings should not be compared using ==, plus some more generics stuff
Modified Paths:
--------------
gate/trunk/src/gate/creole/ir/QueryResultList.java
gate/trunk/src/gate/creole/ir/lucene/LuceneSearch.java
gate/trunk/src/gate/gui/SearchPRViewer.java
Modified: gate/trunk/src/gate/creole/ir/QueryResultList.java
===================================================================
--- gate/trunk/src/gate/creole/ir/QueryResultList.java 2011-11-05 11:53:30 UTC
(rev 14498)
+++ gate/trunk/src/gate/creole/ir/QueryResultList.java 2011-11-05 12:24:12 UTC
(rev 14499)
@@ -27,7 +27,7 @@
private IndexedCorpus corpus;
/** List of QueryResult objects. */
- private List results;
+ private List<QueryResult> results;
/* Niraj */
/* Default Constructor */
@@ -37,7 +37,7 @@
/* End */
/** Constructor of the class. */
- public QueryResultList(String query, IndexedCorpus corpus, List results){
+ public QueryResultList(String query, IndexedCorpus corpus, List<QueryResult>
results){
this.queryString = query;
this.corpus = corpus;
this.results = results;
@@ -55,7 +55,7 @@
/** @return Iterator of QueryResult objects.
* @see gate.creole.ir.QueryResult */
- public Iterator getQueryResults(){
+ public Iterator<QueryResult> getQueryResults(){
return results.iterator();
}
}
\ No newline at end of file
Modified: gate/trunk/src/gate/creole/ir/lucene/LuceneSearch.java
===================================================================
--- gate/trunk/src/gate/creole/ir/lucene/LuceneSearch.java 2011-11-05
11:53:30 UTC (rev 14498)
+++ gate/trunk/src/gate/creole/ir/lucene/LuceneSearch.java 2011-11-05
12:24:12 UTC (rev 14499)
@@ -70,7 +70,8 @@
* Result length is limited. */
public QueryResultList search(String query, int limit, List fieldNames)
throws IndexException,
SearchException{
- Vector result = new Vector();
+
+ List<QueryResult> result = new Vector<QueryResult>();
try {
IndexSearcher searcher = new IndexSearcher(
Modified: gate/trunk/src/gate/gui/SearchPRViewer.java
===================================================================
--- gate/trunk/src/gate/gui/SearchPRViewer.java 2011-11-05 11:53:30 UTC (rev
14498)
+++ gate/trunk/src/gate/gui/SearchPRViewer.java 2011-11-05 12:24:12 UTC (rev
14499)
@@ -46,7 +46,7 @@
}
protected void initLocalData(){
- results = new ArrayList();
+ results = new ArrayList<QueryResult>();
}
protected void initGuiComponents(){
@@ -127,7 +127,7 @@
results.clear();
if(target != null){
QueryResultList resultsList = target.getResult();
- Iterator resIter = resultsList.getQueryResults();
+ Iterator<QueryResult> resIter = resultsList.getQueryResults();
while(resIter.hasNext()){
results.add(resIter.next());
}
@@ -156,7 +156,7 @@
}
}
- public Class getColumnClass(int columnIndex){
+ public Class<?> getColumnClass(int columnIndex){
switch(columnIndex){
case DOC_NAME_COLUMN: return String.class;
case DOC_SCORE_COLUMN: return Float.class;
@@ -275,7 +275,7 @@
protected void firePropertyChange(String propertyName, Object oldValue,
Object newValue) {
// Strings get interned...
- if (propertyName=="text") {
+ if ("text".equals(propertyName)) {
super.firePropertyChange(propertyName, oldValue, newValue);
}
}
@@ -308,6 +308,6 @@
* Contains the {@link gate.creole.ir.QueryResult} objects returned by the
* search.
*/
- List results;
+ List<QueryResult> results;
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs