Revision: 14952
http://gate.svn.sourceforge.net/gate/?rev=14952&view=rev
Author: markagreenwood
Date: 2012-01-09 13:27:44 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
fixed some dead stores and added some generics information
Modified Paths:
--------------
gate/trunk/src/gate/creole/annic/lucene/LuceneDocument.java
gate/trunk/src/gate/creole/annic/lucene/LuceneIndexer.java
gate/trunk/src/gate/creole/annic/lucene/LuceneReader.java
gate/trunk/src/gate/creole/annic/lucene/LuceneTokenizer.java
Modified: gate/trunk/src/gate/creole/annic/lucene/LuceneDocument.java
===================================================================
--- gate/trunk/src/gate/creole/annic/lucene/LuceneDocument.java 2012-01-09
13:19:27 UTC (rev 14951)
+++ gate/trunk/src/gate/creole/annic/lucene/LuceneDocument.java 2012-01-09
13:27:44 UTC (rev 14952)
@@ -60,16 +60,16 @@
*/
public List<Document> createDocuments(String corpusPersistenceID,
gate.Document gateDoc, String documentID,
- ArrayList<String> annotSetsToInclude, ArrayList<String> annotSetsToExclude,
- ArrayList<String> featuresToInclude, ArrayList<String> featuresToExclude,
+ List<String> annotSetsToInclude, List<String> annotSetsToExclude,
+ List<String> featuresToInclude, List<String> featuresToExclude,
String indexLocation, String baseTokenAnnotationType,
Boolean createTokensAutomatically, String indexUnitAnnotationType) {
if(baseTokenAnnotationType != null)
baseTokenAnnotationType = baseTokenAnnotationType.trim();
- ArrayList<Document> toReturnBack = new ArrayList<Document>();
- ArrayList<String> annotSetsToIndex = new ArrayList<String>();
+ List<Document> toReturnBack = new ArrayList<Document>();
+ List<String> annotSetsToIndex = new ArrayList<String>();
// by default merge set must be created
//boolean createMergeSet = true;
@@ -334,7 +334,7 @@
Set<String> indexedFeatures = new HashSet<String>();
// tempBaseTokenAnnotationSet is not null
- ArrayList<Token>[] tokenStreams =
+ List<Token>[] tokenStreams =
getTokens(gateDoc, aSetToIndex, featuresToInclude, featuresToExclude,
baseTokenAnnotationType, baseTokenAnnotationSet,
indexUnitAnnotationType, indexUnitAnnotationSet, indexedFeatures);
@@ -539,7 +539,7 @@
* @param location
* @throws Exception
*/
- private void writeOnDisk(ArrayList tokenStream, String folderName,
+ private void writeOnDisk(List<Token> tokenStream, String folderName,
String fileName, String location) throws Exception {
// before we write it on a disk, we need to change its name to
@@ -603,9 +603,9 @@
* @param indexUnitAnnotationType
* @return
*/
- private ArrayList<Token>[] getTokens(gate.Document document,
- AnnotationSet inputAs, ArrayList<String> featuresToInclude,
- ArrayList<String> featuresToExclude, String baseTokenAnnotationType,
+ private List<Token>[] getTokens(gate.Document document,
+ AnnotationSet inputAs, List<String> featuresToInclude,
+ List<String> featuresToExclude, String baseTokenAnnotationType,
AnnotationSet baseTokenSet, String indexUnitAnnotationType,
AnnotationSet indexUnitSet, Set<String> indexedFeatures) {
Modified: gate/trunk/src/gate/creole/annic/lucene/LuceneIndexer.java
===================================================================
--- gate/trunk/src/gate/creole/annic/lucene/LuceneIndexer.java 2012-01-09
13:19:27 UTC (rev 14951)
+++ gate/trunk/src/gate/creole/annic/lucene/LuceneIndexer.java 2012-01-09
13:27:44 UTC (rev 14952)
@@ -9,6 +9,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.Serializable;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
@@ -402,10 +403,6 @@
private List<gate.creole.annic.apache.lucene.document.Document>
getLuceneDocuments(
String corpusPersistenceID, gate.Document gateDoc, String location)
throws IndexException {
- ArrayList sets_to_include = new ArrayList((List)parameters
- .get(Constants.ANNOTATION_SETS_NAMES_TO_INCLUDE));
- ArrayList sets_to_exclude = new ArrayList((List)parameters
- .get(Constants.ANNOTATION_SETS_NAMES_TO_EXCLUDE));
String baseTokenAnnotationType = (String)parameters
.get(Constants.BASE_TOKEN_ANNOTATION_TYPE);
@@ -413,16 +410,16 @@
String indexUnitAnnotationType = (String)parameters
.get(Constants.INDEX_UNIT_ANNOTATION_TYPE);
- ArrayList featuresToExclude = new ArrayList((List)parameters
+ List<String> featuresToExclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.FEATURES_TO_EXCLUDE));
- ArrayList featuresToInclude = new ArrayList((List)parameters
+ List<String> featuresToInclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.FEATURES_TO_INCLUDE));
- ArrayList annotationSetsToExclude = new ArrayList((List)parameters
+ List<String> annotationSetsToExclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.ANNOTATION_SETS_NAMES_TO_EXCLUDE));
- ArrayList annotationSetsToInclude = new ArrayList((List)parameters
+ List<String> annotationSetsToInclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.ANNOTATION_SETS_NAMES_TO_INCLUDE));
Boolean createTokensAutomatically = (Boolean)
parameters.get(Constants.CREATE_TOKENS_AUTOMATICALLY);
@@ -489,7 +486,7 @@
new com.thoughtworks.xstream.io.xml.StaxDriver());
// Saving is accomplished just using XML serialization of the map.
- this.parameters = (HashMap)xstream.fromXML(fileReader);
+ this.parameters = (Map)xstream.fromXML(fileReader);
// setting the index location URL
this.parameters.put(Constants.INDEX_LOCATION_URL, indexLocationUrl);
}
@@ -516,7 +513,7 @@
}
java.io.FileWriter fileWriter = new java.io.FileWriter(file);
- HashMap indexInformation = new HashMap();
+ Map indexInformation = new HashMap();
Iterator iter = parameters.keySet().iterator();
while(iter.hasNext()) {
Object key = iter.next();
Modified: gate/trunk/src/gate/creole/annic/lucene/LuceneReader.java
===================================================================
--- gate/trunk/src/gate/creole/annic/lucene/LuceneReader.java 2012-01-09
13:19:27 UTC (rev 14951)
+++ gate/trunk/src/gate/creole/annic/lucene/LuceneReader.java 2012-01-09
13:27:44 UTC (rev 14952)
@@ -7,8 +7,12 @@
*/
package gate.creole.annic.lucene;
-import java.io.*;
+import gate.creole.annic.apache.lucene.analysis.Token;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
import java.util.ArrayList;
+import java.util.List;
/**
* A Reader that stores the document to read and the token stream
@@ -27,7 +31,7 @@
/**
* Token Stream.
*/
- ArrayList tokenStream;
+ List<Token> tokenStream;
/**
* Constructor
@@ -35,7 +39,7 @@
* @param gateDoc
* @param tokenStream
*/
- public LuceneReader(gate.Document gateDoc, ArrayList tokenStream) {
+ public LuceneReader(gate.Document gateDoc, List<Token> tokenStream) {
super(new StringReader(""));
this.gateDoc = gateDoc;
this.tokenStream = tokenStream;
@@ -55,7 +59,7 @@
*
* @return
*/
- public ArrayList getTokenStream() {
+ public List<Token> getTokenStream() {
return this.tokenStream;
}
}
Modified: gate/trunk/src/gate/creole/annic/lucene/LuceneTokenizer.java
===================================================================
--- gate/trunk/src/gate/creole/annic/lucene/LuceneTokenizer.java
2012-01-09 13:19:27 UTC (rev 14951)
+++ gate/trunk/src/gate/creole/annic/lucene/LuceneTokenizer.java
2012-01-09 13:27:44 UTC (rev 14952)
@@ -19,15 +19,15 @@
*/
public class LuceneTokenizer extends TokenStream {
Document document;
- ArrayList tokens;
- ArrayList featuresToExclude;
+ List<Token> tokens;
+ List featuresToExclude;
int pointer = 0;
/**
* Constructor
* @param tokenStream
*/
- public LuceneTokenizer(ArrayList tokenStream) {
+ public LuceneTokenizer(List<Token> tokenStream) {
this.tokens = tokenStream;
pointer = 0;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs