Revision: 17616
http://sourceforge.net/p/gate/code/17616
Author: markagreenwood
Date: 2014-03-10 16:09:07 +0000 (Mon, 10 Mar 2014)
Log Message:
-----------
fixed or supressed a bunch more generics warnings -- warning count is now
measured in 3 figures :)
Modified Paths:
--------------
gate/trunk/src/main/gate/annotation/AnnotationImpl.java
gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java
gate/trunk/src/main/gate/annotation/NodeImpl.java
gate/trunk/src/main/gate/corpora/DocumentImpl.java
gate/trunk/src/main/gate/corpora/SerialCorpusImpl.java
gate/trunk/src/main/gate/corpora/TextualDocumentFormat.java
gate/trunk/src/main/gate/creole/AbstractController.java
gate/trunk/src/main/gate/creole/annic/Indexer.java
gate/trunk/src/main/gate/creole/annic/Parser.java
gate/trunk/src/main/gate/creole/annic/Searchable.java
gate/trunk/src/main/gate/creole/annic/lucene/LuceneIndexer.java
gate/trunk/src/main/gate/creole/annic/lucene/LuceneQueryResult.java
gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearchThread.java
gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearcher.java
gate/trunk/src/main/gate/creole/annic/lucene/LuceneTokenizer.java
gate/trunk/src/main/gate/creole/coref/NominalCoref.java
gate/trunk/src/main/gate/creole/coref/PronominalCoref.java
gate/trunk/src/main/gate/gui/CollectionSelectionDialog.java
gate/trunk/src/main/gate/gui/FeaturesSchemaEditor.java
gate/trunk/src/main/gate/gui/ListEditorDialog.java
gate/trunk/src/main/gate/gui/SyntaxTreeViewer.java
gate/trunk/src/main/gate/jape/SinglePhaseTransducer.java
gate/trunk/src/main/gate/jape/SourceInfo.java
gate/trunk/src/main/gate/jape/Transducer.java
gate/trunk/src/main/gate/persist/LuceneDataStoreImpl.java
gate/trunk/src/main/gate/persist/PersistenceException.java
gate/trunk/src/main/gate/persist/SerialDataStore.java
gate/trunk/src/main/gate/util/Benchmark.java
Modified: gate/trunk/src/main/gate/annotation/AnnotationImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/AnnotationImpl.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/annotation/AnnotationImpl.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -32,9 +32,6 @@
public class AnnotationImpl extends AbstractFeatureBearer
implements Annotation, FeatureBearer {
- /** Debug flag
- */
- private static final boolean DEBUG = false;
/** Freeze the serialization UID. */
static final long serialVersionUID = -5658993256574857725L;
Modified: gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -64,7 +64,6 @@
import java.util.Vector;
import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
/**
* Implementation of AnnotationSet. Has a number of indices, all bar one of
@@ -86,7 +85,6 @@
*/
public class AnnotationSetImpl extends AbstractSet<Annotation> implements
AnnotationSet {
- private static final Logger log = Logger.getLogger(AnnotationSetImpl.class);
/** Freeze the serialization UID. */
static final long serialVersionUID = 1479426765310434166L;
/** The name of this set */
Modified: gate/trunk/src/main/gate/annotation/NodeImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/NodeImpl.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/annotation/NodeImpl.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -23,10 +23,6 @@
*/
public class NodeImpl implements Node, Comparable<Node>
{
- /** Debug flag
- */
- private static final boolean DEBUG = false;
-
/** Freeze the serialization UID. */
static final long serialVersionUID = -8240414984367916298L;
Modified: gate/trunk/src/main/gate/corpora/DocumentImpl.java
===================================================================
--- gate/trunk/src/main/gate/corpora/DocumentImpl.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/corpora/DocumentImpl.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -957,6 +957,7 @@
* @return The XML document obtained from raw text + the information from the
* dump annotation set.
*/
+ @SuppressWarnings("unused")
private String saveAnnotationSetAsXml(AnnotationSet aDumpAnnotSet,
boolean includeFeatures) {
String content = null;
@@ -1770,6 +1771,7 @@
* The annotation set possibly containing the root annotation.
* @return The root annotation or null is it fails
*/
+ @SuppressWarnings("unused")
private Annotation identifyTheRootAnnotation(AnnotationSet anAnnotationSet) {
if(anAnnotationSet == null) return null;
// If the starting node of this annotation is not null, then the annotation
@@ -2040,20 +2042,6 @@
}// toXml
/**
- * This method saves an AnnotationSet as XML.
- * May be removed once GLEAM doc-service is updated.
- *
- * @param anAnnotationSet
- * The annotation set that has to be saved as XML.
- * @return a String like this: <AnnotationSet> <Annotation>....
- * </AnnotationSet>
- */
- private void annotationSetToXml(AnnotationSet anAnnotationSet,
- StringBuffer buffer) {
- DocumentXmlUtils.annotationSetToXml(anAnnotationSet, buffer);
- }// annotationSetToXml
-
- /**
* Returns a map (possibly empty) with the named annotation sets. It returns
<code>null</code>
* if no named annotaton set exists.
*/
Modified: gate/trunk/src/main/gate/corpora/SerialCorpusImpl.java
===================================================================
--- gate/trunk/src/main/gate/corpora/SerialCorpusImpl.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/corpora/SerialCorpusImpl.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -147,8 +147,8 @@
* @return a {@link List} of Objects representing the persistent IDs
* of the documents in this corpus.
*/
- public List getDocumentPersistentIDs() {
- List docsIDs = new ArrayList();
+ public List<Object> getDocumentPersistentIDs() {
+ List<Object> docsIDs = new ArrayList<Object>();
if(docDataList == null) return docsIDs;
Iterator<DocumentData> iter = docDataList.iterator();
while(iter.hasNext()) {
Modified: gate/trunk/src/main/gate/corpora/TextualDocumentFormat.java
===================================================================
--- gate/trunk/src/main/gate/corpora/TextualDocumentFormat.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/corpora/TextualDocumentFormat.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -156,6 +156,7 @@
} // setNewLineProperty()
/** Delete '\r' in combination CRLF or LFCR in document content */
+ @SuppressWarnings("unused")
private void removeExtraNewLine(Document doc) {
String content = doc.getContent().toString();
StringBuffer buff = new StringBuffer(content);
Modified: gate/trunk/src/main/gate/creole/AbstractController.java
===================================================================
--- gate/trunk/src/main/gate/creole/AbstractController.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/AbstractController.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -51,7 +51,7 @@
/**
* Shared featureMap
*/
- protected Map<String,String> benchmarkFeatures = new
HashMap<String,String>();
+ protected Map<Object,Object> benchmarkFeatures = new
HashMap<Object,Object>();
// executable code
/**
Modified: gate/trunk/src/main/gate/creole/annic/Indexer.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/Indexer.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/Indexer.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -27,7 +27,7 @@
* depend on the implementing IndexManager
* @throws IndexException
*/
- public void createIndex(Map parameters) throws IndexException;
+ public void createIndex(Map<String,Object> parameters) throws IndexException;
/** Optimize the existing index */
public void optimizeIndex() throws IndexException;
@@ -51,7 +51,7 @@
* @param removedDocumentPersistenceIds
* @throws Exception
*/
- public void remove(List removedDocumentPersistenceIds) throws IndexException;
+ public void remove(List<Object> removedDocumentPersistenceIds) throws
IndexException;
/**
* Set the corpus to be indexed
@@ -68,5 +68,5 @@
/**
* Returns the parameters
*/
- public Map getParameters();
+ public Map<String,Object> getParameters();
}
Modified: gate/trunk/src/main/gate/creole/annic/Parser.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/Parser.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/Parser.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -238,7 +238,7 @@
// rootElement is HITS
// this will internally contains instances of HIT
- List hitsChildren = rootElement.getChildren(HIT);
+ List<?> hitsChildren = rootElement.getChildren(HIT);
Hit[] hits = new Hit[hitsChildren.size()];
for(int i = 0; i < hitsChildren.size(); i++) {
@@ -255,7 +255,7 @@
continue;
}
- List patAnnots = patternAnnotations.getChildren(PATTERN_ANNOTATION);
+ List<?> patAnnots = patternAnnotations.getChildren(PATTERN_ANNOTATION);
List<PatternAnnotation> patAnnotsList = new
ArrayList<PatternAnnotation>();
for(int j = 0; j < patAnnots.size(); j++) {
Element patAnnot = (Element)patAnnots.get(j);
@@ -269,7 +269,7 @@
// we need to find out its features
Element featuresElem = patAnnot.getChild(FEATURES);
// more than one features possible
- List featuresElemsList = featuresElem.getChildren(FEATURE);
+ List<?> featuresElemsList = featuresElem.getChildren(FEATURE);
for(int k = 0; k < featuresElemsList.size(); k++) {
Element featureElem = (Element)featuresElemsList.get(k);
String key = featureElem.getChildText(KEY);
Modified: gate/trunk/src/main/gate/creole/annic/Searchable.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/Searchable.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/Searchable.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -27,7 +27,7 @@
* implementation of provided indexer
* @throws IndexException
*/
- public void setIndexer(Indexer indexer, Map parameters) throws
IndexException;
+ public void setIndexer(Indexer indexer, Map<String,Object> parameters)
throws IndexException;
/**
* Returns the Indexer
@@ -55,7 +55,7 @@
* @return true if the search was successful
* @throws SearchException
*/
- public boolean search(String query, Map searchParameters)
+ public boolean search(String query, Map<String,Object> searchParameters)
throws SearchException;
/**
Modified: gate/trunk/src/main/gate/creole/annic/lucene/LuceneIndexer.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/lucene/LuceneIndexer.java
2014-03-10 11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/lucene/LuceneIndexer.java
2014-03-10 16:09:07 UTC (rev 17616)
@@ -50,7 +50,7 @@
/**
* Various parameters such as location of the Index etc.
*/
- protected Map parameters;
+ protected Map<String,Object> parameters;
/**
* Constructor
@@ -67,7 +67,7 @@
/**
* Checks the Index Parameters to see if they are all compatible
*/
- protected void checkIndexParameters(Map parameters) throws IndexException {
+ protected void checkIndexParameters(Map<String,Object> parameters) throws
IndexException {
this.parameters = parameters;
if(parameters == null) {
@@ -123,7 +123,7 @@
/**
* Returns the indexing parameters
*/
- protected Map getIndexParameters() {
+ protected Map<String,Object> getIndexParameters() {
return this.parameters;
}
@@ -148,7 +148,7 @@
*
*/
@Override
- public void createIndex(Map indexParameters) throws IndexException {
+ public void createIndex(Map<String,Object> indexParameters) throws
IndexException {
checkIndexParameters(indexParameters);
URL indexLocation = (URL)parameters.get(Constants.INDEX_LOCATION_URL);
@@ -324,7 +324,7 @@
* @throws Exception
*/
@Override
- public void remove(List removedIDs) throws IndexException {
+ public void remove(List<Object> removedIDs) throws IndexException {
String location = null;
try {
@@ -404,15 +404,19 @@
String indexUnitAnnotationType = (String)parameters
.get(Constants.INDEX_UNIT_ANNOTATION_TYPE);
+ @SuppressWarnings("unchecked")
List<String> featuresToExclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.FEATURES_TO_EXCLUDE));
+ @SuppressWarnings("unchecked")
List<String> featuresToInclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.FEATURES_TO_INCLUDE));
+ @SuppressWarnings("unchecked")
List<String> annotationSetsToExclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.ANNOTATION_SETS_NAMES_TO_EXCLUDE));
+ @SuppressWarnings("unchecked")
List<String> annotationSetsToInclude = new
ArrayList<String>((List<String>)parameters
.get(Constants.ANNOTATION_SETS_NAMES_TO_INCLUDE));
@@ -461,6 +465,7 @@
* @param indexLocationUrl
* @throws IOException
*/
+ @SuppressWarnings("unchecked")
private void readParametersFromDisk(URL indexLocationUrl) throws IOException
{
// we create a hashmap to store index definition in the index
// directory
@@ -482,7 +487,7 @@
new com.thoughtworks.xstream.io.xml.StaxDriver());
// Saving is accomplished just using XML serialization of the map.
- this.parameters = (Map)xstream.fromXML(fileReader);
+ this.parameters = (Map<String,Object>)xstream.fromXML(fileReader);
// setting the index location URL
this.parameters.put(Constants.INDEX_LOCATION_URL, indexLocationUrl);
}
@@ -509,10 +514,10 @@
}
java.io.FileWriter fileWriter = new java.io.FileWriter(file);
- Map indexInformation = new HashMap();
- Iterator iter = parameters.keySet().iterator();
+ Map<String,Object> indexInformation = new HashMap<String,Object>();
+ Iterator<String> iter = parameters.keySet().iterator();
while(iter.hasNext()) {
- Object key = iter.next();
+ String key = iter.next();
if(key.equals(Constants.INDEX_LOCATION_URL)) continue;
indexInformation.put(key, parameters.get(key));
}
@@ -540,7 +545,7 @@
* Returns the set parameters
*/
@Override
- public Map getParameters() {
+ public Map<String,Object> getParameters() {
return this.parameters;
}
Modified: gate/trunk/src/main/gate/creole/annic/lucene/LuceneQueryResult.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/lucene/LuceneQueryResult.java
2014-03-10 11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/lucene/LuceneQueryResult.java
2014-03-10 16:09:07 UTC (rev 17616)
@@ -23,7 +23,7 @@
private String annotationSetName;
- private List firstTermPositions;
+ private List<?> firstTermPositions;
private List<Integer> patternLength;
@@ -43,7 +43,7 @@
* @param gateAnnotations
* @param query
*/
- public LuceneQueryResult(Object docID, String annotationSetName, List
firstTermPositions,
+ public LuceneQueryResult(Object docID, String annotationSetName, List<?>
firstTermPositions,
List<Integer> patternLength, int queryType,
List<List<PatternAnnotation>> gateAnnotations,
String query) {
this.docID = docID;
@@ -81,7 +81,7 @@
* Integer values indicating positions of first annotations of
* found patterns in the token stream.
*/
- public List getFirstTermPositions() {
+ public List<?> getFirstTermPositions() {
return firstTermPositions;
}
Modified: gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearchThread.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearchThread.java
2014-03-10 11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearchThread.java
2014-03-10 16:09:07 UTC (rev 17616)
@@ -146,6 +146,7 @@
* instance of SearchThread is invoked
* @return true iff search was successful false otherwise
*/
+ @SuppressWarnings("unchecked")
public boolean search(String query, int patternWindow, String indexLocation,
String corpusToSearchIn, String annotationSetToSearchIn,
LuceneSearcher luceneSearcher) throws SearchException {
@@ -213,14 +214,14 @@
java.io.FileReader fileReader = new java.io.FileReader(indexLocation
+ "LuceneIndexDefinition.xml");
- HashMap indexInformation = null;
+ Map<String,Object> indexInformation = null;
try {
// other wise read this file
com.thoughtworks.xstream.XStream xstream = new
com.thoughtworks.xstream.XStream(
new com.thoughtworks.xstream.io.xml.StaxDriver());
// Saving was accomplished by using XML serialization of the map.
- indexInformation = (HashMap)xstream.fromXML(fileReader);
+ indexInformation = (Map<String,Object>)xstream.fromXML(fileReader);
}
finally {
fileReader.close();
@@ -283,7 +284,7 @@
* returned results. first term position is the position of the
* first term in the found pattern
*/
- ArrayList[] firstTermPositions = searcher.getFirstTermPositions();
+ List<?>[] firstTermPositions = searcher.getFirstTermPositions();
// if no result available, set null to our scores
if(firstTermPositions[0].size() == 0) {
// do nothing
@@ -300,7 +301,7 @@
// we fetch all the first term positions for the query
// issued
- ArrayList ftp = (ArrayList)firstTermPositions[1].get(index);
+ List<?> ftp = (List<?>)firstTermPositions[1].get(index);
/*
* pattern length (in terms of total number of annotations
@@ -367,7 +368,7 @@
/**
* First term positions.
*/
- private List ftp;
+ private List<?> ftp;
/**
* This method returns a list containing instances of Pattern
@@ -496,7 +497,7 @@
private List<Pattern> createAnnicPatterns(LuceneQueryResult aResult) {
// get the result from search engine
List<Pattern> annicPatterns = new ArrayList<Pattern>();
- List firstTermPositions = aResult.getFirstTermPositions();
+ List<?> firstTermPositions = aResult.getFirstTermPositions();
if(firstTermPositions != null && firstTermPositions.size() > 0) {
List<Integer> patternLength = aResult.patternLength();
// locate Pattern
@@ -523,12 +524,12 @@
*/
private List<Pattern> locatePatterns(String docID, String annotationSetName,
List<List<PatternAnnotation>> gateAnnotations,
- List firstTermPositions, List<Integer> patternLength,
+ List<?> firstTermPositions, List<Integer> patternLength,
String queryString) {
// patterns
List<Pattern> pats = new ArrayList<Pattern>();
- outer: for(int i = 0; i < gateAnnotations.size(); i++) {
+ for(int i = 0; i < gateAnnotations.size(); i++) {
// each element in the tokens stream is a pattern
List<PatternAnnotation> annotations = gateAnnotations.get(i);
@@ -671,6 +672,7 @@
ObjectInput input = new ObjectInputStream(buffer);
// deserialize the List
+ @SuppressWarnings("unchecked")
List<gate.creole.annic.apache.lucene.analysis.Token> recoveredTokenStream
=
(List<gate.creole.annic.apache.lucene.analysis.Token>)input.readObject();
if(input != null) {
@@ -765,6 +767,7 @@
* @param query String
* @return PatternResult
*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
private PatternResult getPatternResult(
List<gate.creole.annic.apache.lucene.analysis.Token> subTokens,
String annotationSetName, int patLen, int patWindow, String query,
@@ -1061,6 +1064,7 @@
String annotationSetName;
+ @SuppressWarnings("rawtypes")
List firstTermPositions;
List<Integer> patternLegths;
@@ -1073,18 +1077,22 @@
*
*/
private class QueryItem {
+ @SuppressWarnings("unused")
float score;
+ @SuppressWarnings("unused")
int id;
String documentID;
+ @SuppressWarnings("rawtypes")
List ftp;
int patLen;
int qType;
+ @SuppressWarnings("unused")
Query query;
String queryString;
@@ -1124,6 +1132,7 @@
/**
* Checks if two first term positions are identical.
*/
+ @SuppressWarnings({"unused", "rawtypes"})
private boolean areTheyEqual(List ftp, List ftp1, int qType) {
if(qType == 1) {
if(ftp.size() == ftp1.size()) {
Modified: gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearcher.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearcher.java
2014-03-10 11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/lucene/LuceneSearcher.java
2014-03-10 16:09:07 UTC (rev 17616)
@@ -191,6 +191,7 @@
/**
* Method retunrs true/false indicating whether results were found or not.
*/
+ @SuppressWarnings("unchecked")
@Override
public boolean search(String query, Map<String, Object> parameters)
throws SearchException {
Modified: gate/trunk/src/main/gate/creole/annic/lucene/LuceneTokenizer.java
===================================================================
--- gate/trunk/src/main/gate/creole/annic/lucene/LuceneTokenizer.java
2014-03-10 11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/annic/lucene/LuceneTokenizer.java
2014-03-10 16:09:07 UTC (rev 17616)
@@ -20,7 +20,7 @@
public class LuceneTokenizer extends TokenStream {
Document document;
List<Token> tokens;
- List featuresToExclude;
+ //List featuresToExclude;
int pointer = 0;
/**
Modified: gate/trunk/src/main/gate/creole/coref/NominalCoref.java
===================================================================
--- gate/trunk/src/main/gate/creole/coref/NominalCoref.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/coref/NominalCoref.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -502,6 +502,7 @@
}
/** Get the text of an annotation */
+ @SuppressWarnings("unused")
private String stringValue(Annotation ann) {
Object[] tokens = getSortedTokens(ann);
Modified: gate/trunk/src/main/gate/creole/coref/PronominalCoref.java
===================================================================
--- gate/trunk/src/main/gate/creole/coref/PronominalCoref.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/creole/coref/PronominalCoref.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -1246,8 +1246,10 @@
private class Sentence {
/** --- */
+ @SuppressWarnings("unused")
private int sentNumber;
/** --- */
+ @SuppressWarnings("unused")
private int paraNumber;
/** --- */
private Long startOffset;
Modified: gate/trunk/src/main/gate/gui/CollectionSelectionDialog.java
===================================================================
--- gate/trunk/src/main/gate/gui/CollectionSelectionDialog.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/gui/CollectionSelectionDialog.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -16,12 +16,28 @@
package gate.gui;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
-import javax.swing.*;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.DefaultListModel;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JScrollPane;
+import javax.swing.ListSelectionModel;
/** This class visually selects some items from a collection and returns
@@ -80,11 +96,12 @@
/** Init local data from a source collection
* @param aSourceData is the collection from what the user will choose
*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
protected void initLocalData(Collection aSourceData){
targetListModel = new DefaultListModel();
sourceListModel = new DefaultListModel();
if (aSourceData == null) return;
- ArrayList source = new ArrayList(aSourceData);
+ List source = new ArrayList(aSourceData);
Collections.sort(source);
Iterator iter = source.iterator();
while(iter.hasNext()){
@@ -234,8 +251,9 @@
}// end for
}// doAdd();
/** Returns the target collection*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
public Collection getSelectedCollection(){
- ArrayList resultsList = new ArrayList();
+ List resultsList = new ArrayList();
for (int i=0; i<targetListModel.getSize(); i++){
resultsList.add(targetListModel.getElementAt(i));
}// End for
@@ -243,6 +261,7 @@
}// getSelectedCollection()
/** This method displays the CollectionSelectionDialog*/
+ @SuppressWarnings("rawtypes")
public int show(String aTitle,Collection aSourceData){
if (aTitle == null){
JOptionPane.showMessageDialog(mainFrame,
Modified: gate/trunk/src/main/gate/gui/FeaturesSchemaEditor.java
===================================================================
--- gate/trunk/src/main/gate/gui/FeaturesSchemaEditor.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/gui/FeaturesSchemaEditor.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -198,6 +198,7 @@
* Fire a table data changed event for the feature table whith featureList
* used as data model.
*/
+ @SuppressWarnings({"rawtypes", "unchecked"})
protected void populate(){
featureList.clear();
//get all the existing features
Modified: gate/trunk/src/main/gate/gui/ListEditorDialog.java
===================================================================
--- gate/trunk/src/main/gate/gui/ListEditorDialog.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/gui/ListEditorDialog.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -30,7 +30,7 @@
/**
* A simple editor for Collection values.
*/
-@SuppressWarnings("serial")
+@SuppressWarnings({"serial","rawtypes","unchecked"})
public class ListEditorDialog extends JDialog {
/**
@@ -108,7 +108,7 @@
if(SortedSet.class.isAssignableFrom(collectionType)
&& data != null) {
- comparator = ((SortedSet)data).comparator();
+ comparator = ((SortedSet<?>)data).comparator();
}
if(comparator == null) {
comparator = new NaturalComparator();
Modified: gate/trunk/src/main/gate/gui/SyntaxTreeViewer.java
===================================================================
--- gate/trunk/src/main/gate/gui/SyntaxTreeViewer.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/gui/SyntaxTreeViewer.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -253,6 +253,7 @@
}
//CONSTRUCTORS
+ @SuppressWarnings("unused")
private SyntaxTreeViewer(String annotType) {
treeNodeAnnotationType = annotType;
@@ -1466,14 +1467,17 @@
super(text);
}
+ @SuppressWarnings("unused")
public FocusButton() {
super();
}
+ @SuppressWarnings("unused")
public FocusButton(Icon icon) {
super(icon);
}
+ @SuppressWarnings("unused")
public FocusButton(String text, Icon icon) {
super(text, icon);
}// public FocusButton
Modified: gate/trunk/src/main/gate/jape/SinglePhaseTransducer.java
===================================================================
--- gate/trunk/src/main/gate/jape/SinglePhaseTransducer.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/jape/SinglePhaseTransducer.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -285,6 +285,7 @@
List<FSMInstance> acceptingFSMInstances = new LinkedList<FSMInstance>();
// find the first node of the document
+ @SuppressWarnings("unchecked")
Node startNode = ((List<Annotation>)annotationsByOffset.get(offsets
.first())).get(0).getStartNode();
@@ -656,6 +657,7 @@
* @return true if processing should keep going, false otherwise.
*/
+ @SuppressWarnings("unchecked")
protected boolean fireRule(List<FSMInstance> acceptingFSMInstances,
SearchState state, long lastNodeOff, SimpleSortedSet offsets,
AnnotationSet inputAS, AnnotationSet outputAS, Document doc,
Modified: gate/trunk/src/main/gate/jape/SourceInfo.java
===================================================================
--- gate/trunk/src/main/gate/jape/SourceInfo.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/jape/SourceInfo.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -149,6 +149,7 @@
return (startLine <= lineNumber && lineNumber <= endLine);
}
+ @SuppressWarnings("unused")
public String getNumberedSource(String source) {
return Strings.addLineNumbers(getSource(source), japeLine);
}
Modified: gate/trunk/src/main/gate/jape/Transducer.java
===================================================================
--- gate/trunk/src/main/gate/jape/Transducer.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/jape/Transducer.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -49,7 +49,7 @@
/**
* Shared featureMap
*/
- protected Map benchmarkFeatures = new HashMap();
+ protected Map<Object,Object> benchmarkFeatures = new
HashMap<Object,Object>();
/**
* Benchmark ID of this transducer.
Modified: gate/trunk/src/main/gate/persist/LuceneDataStoreImpl.java
===================================================================
--- gate/trunk/src/main/gate/persist/LuceneDataStoreImpl.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/persist/LuceneDataStoreImpl.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -51,6 +51,8 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.commons.io.IOUtils;
+
public class LuceneDataStoreImpl extends SerialDataStore implements
SearchableDataStore,
CorpusListener,
@@ -109,7 +111,7 @@
/**
* Index Parameters
*/
- protected Map indexParameters;
+ protected Map<String,Object> indexParameters;
/**
* URL of the index
@@ -124,7 +126,7 @@
/**
* This is where we store the search parameters
*/
- protected Map searchParameters;
+ protected Map<String,Object> searchParameters;
/** Close the data store. */
@Override
@@ -173,9 +175,9 @@
* want to support old style: String versionInVersionFile = "1.0";
* (but this means it will open *any* directory)
*/
+ BufferedReader isr = null;
try {
- FileReader fis = new FileReader(getVersionFile());
- BufferedReader isr = new BufferedReader(fis);
+ isr = new BufferedReader(new FileReader(getVersionFile()));
currentProtocolVersion = isr.readLine();
String indexDirRelativePath = isr.readLine();
@@ -196,10 +198,12 @@
this.searcher = new LuceneSearcher();
((LuceneSearcher)this.searcher).setLuceneDatastore(this);
}
- isr.close();
} catch(IOException e) {
throw new PersistenceException("Invalid storage directory: " + e);
+ } finally {
+ IOUtils.closeQuietly(isr);
}
+
if(!isValidProtocolVersion(currentProtocolVersion))
throw new PersistenceException("Invalid protocol version number: "
+ currentProtocolVersion);
@@ -439,7 +443,7 @@
* Sets the Indexer to be used for indexing Datastore
*/
@Override
- public void setIndexer(Indexer indexer, Map indexParameters)
+ public void setIndexer(Indexer indexer, Map<String,Object> indexParameters)
throws IndexException {
this.indexer = indexer;
@@ -504,7 +508,7 @@
* Search the datastore
*/
@Override
- public boolean search(String query, Map searchParameters)
+ public boolean search(String query, Map<String,Object> searchParameters)
throws SearchException {
return this.searcher.search(query, searchParameters);
}
@@ -701,7 +705,7 @@
* belongs to one easy way is to check all instances of
* serial corpus loaded in memory
*/
- List scs =
+ List<LanguageResource> scs =
Gate.getCreoleRegister().getLrInstances(
SerialCorpusImpl.class.getName());
if(scs != null) {
@@ -709,7 +713,7 @@
* we need to check which corpus the deleted class
* belonged to
*/
- Iterator iter = scs.iterator();
+ Iterator<LanguageResource> iter = scs.iterator();
while(iter.hasNext()) {
SerialCorpusImpl sci = (SerialCorpusImpl)iter.next();
if(sci != null) {
@@ -728,7 +732,7 @@
* relevant corpus won't exist in memory
*/
if(corpusPID == null) {
- List corpusPIDs = getLrIds(SerialCorpusImpl.class.getName());
+ List<String> corpusPIDs =
getLrIds(SerialCorpusImpl.class.getName());
if(corpusPIDs != null) {
for(int i = 0; i < corpusPIDs.size(); i++) {
Object corpusID = corpusPIDs.get(i);
Modified: gate/trunk/src/main/gate/persist/PersistenceException.java
===================================================================
--- gate/trunk/src/main/gate/persist/PersistenceException.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/persist/PersistenceException.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -21,9 +21,9 @@
/** This exception indicates failure during persistence operations.
*/
public class PersistenceException extends GateException {
- /** Debug flag */
- private static final boolean DEBUG = false;
+ private static final long serialVersionUID = 3021649267577030175L;
+
/** Default construction */
public PersistenceException() { super(); }
Modified: gate/trunk/src/main/gate/persist/SerialDataStore.java
===================================================================
--- gate/trunk/src/main/gate/persist/SerialDataStore.java 2014-03-10
11:10:08 UTC (rev 17615)
+++ gate/trunk/src/main/gate/persist/SerialDataStore.java 2014-03-10
16:09:07 UTC (rev 17616)
@@ -67,6 +67,8 @@
public class SerialDataStore
extends AbstractFeatureBearer implements DataStore {
+ private static final long serialVersionUID = -2109852254191554517L;
+
/** Debug flag */
private static final boolean DEBUG = false;
@@ -807,6 +809,7 @@
}
/** Get a list of LRs that satisfy some set or restrictions */
+ @SuppressWarnings("rawtypes")
@Override
public List findLrIds(List constraints) throws PersistenceException {
throw new UnsupportedOperationException(
@@ -817,6 +820,7 @@
* Get a list of LRs that satisfy some set or restrictions and are
* of a particular type
*/
+ @SuppressWarnings("rawtypes")
@Override
public List findLrIds(List constraints, String lrType) throws
PersistenceException {
throw new UnsupportedOperationException(
Modified: gate/trunk/src/main/gate/util/Benchmark.java
===================================================================
--- gate/trunk/src/main/gate/util/Benchmark.java 2014-03-10 11:10:08 UTC
(rev 17615)
+++ gate/trunk/src/main/gate/util/Benchmark.java 2014-03-10 16:09:07 UTC
(rev 17616)
@@ -155,7 +155,7 @@
* invoked on the objects.
*/
public static void checkPoint(long startTime, String benchmarkID,
- Object objectInvokingThisCheckPoint, Map benchmarkingFeatures) {
+ Object objectInvokingThisCheckPoint, Map<Object,Object>
benchmarkingFeatures) {
// check if logging is disabled
if(!benchmarkingEnabled) return;
@@ -181,7 +181,7 @@
* invoked on the objects.
*/
public static void checkPointWithDuration(long totalTime, String benchmarkID,
- Object objectInvokingThisCheckPoint, Map benchmarkingFeatures) {
+ Object objectInvokingThisCheckPoint, Map<Object,Object>
benchmarkingFeatures) {
// check if logging is disabled
if(!benchmarkingEnabled) return;
@@ -197,7 +197,7 @@
* @see #checkPoint(long, String, Object, Map)
*/
public static void checkPoint(String benchmarkID,
- Object objectInvokingThisCheckPoint, Map benchmarkingFeatures) {
+ Object objectInvokingThisCheckPoint, Map<Object,Object>
benchmarkingFeatures) {
if(!benchmarkingEnabled) return;
logCheckPoint("END", benchmarkID, objectInvokingThisCheckPoint,
benchmarkingFeatures);
@@ -211,7 +211,7 @@
*/
private static void logCheckPoint(String processingTimeOrFlag,
String benchmarkID, Object objectInvokingThisCheckPoint,
- Map benchmarkingFeatures) {
+ Map<Object,Object> benchmarkingFeatures) {
// finally build the string to be logged
StringBuilder messageToLog = new StringBuilder();
messageToLog.append("" + System.currentTimeMillis() + " ");
@@ -286,7 +286,7 @@
*/
public static void executeWithBenchmarking(Executable executable,
String benchmarkID, Object objectInvokingThisCheckPoint,
- Map benchmarkingFeatures) throws ExecutionException {
+ Map<Object,Object> benchmarkingFeatures) throws ExecutionException {
if(!benchmarkingEnabled) {
executable.execute();
}
@@ -302,7 +302,7 @@
executable.execute();
}
catch(Exception e) {
- Map tempFeatures = new HashMap();
+ Map<Object,Object> tempFeatures = new HashMap<Object,Object>();
if(benchmarkingFeatures != null) {
tempFeatures.putAll(benchmarkingFeatures);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs