Revision: 17667
http://sourceforge.net/p/gate/code/17667
Author: markagreenwood
Date: 2014-03-15 08:57:17 +0000 (Sat, 15 Mar 2014)
Log Message:
-----------
that's all the plugins whose name starts with A cleaned up and the compiler
warnings turned on
Modified Paths:
--------------
gate/trunk/plugins/Alignment/build.xml
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentAction.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentActionsManager.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentEditor.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentFactory.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultDataModel.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultIteratingMethod.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/actions/impl/AlignmentCache.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/LinksView.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/MatrixView.java
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/ParallelTextView.java
gate/trunk/plugins/Alignment/src/gate/composite/CombiningMethod.java
gate/trunk/plugins/Alignment/src/gate/composite/impl/AbstractCombiningMethod.java
gate/trunk/plugins/Alignment/src/gate/composite/impl/CombineFromAnnotID.java
gate/trunk/plugins/Alignment/src/gate/composite/impl/CompositeDocumentImpl.java
gate/trunk/plugins/Alignment/src/gate/composite/impl/DefaultCombiningMethod.java
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java
gate/trunk/plugins/Alignment/src/gate/compound/CompoundDocument.java
gate/trunk/plugins/Alignment/src/gate/compound/gui/CompoundDocumentEditor.java
gate/trunk/plugins/Alignment/src/gate/compound/impl/AbstractCompoundDocument.java
gate/trunk/plugins/Alignment/src/gate/compound/impl/AnnotationStream.java
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentFromXml.java
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentImpl.java
gate/trunk/plugins/Annotation_Merging/build.xml
gate/trunk/plugins/Annotation_Merging/src/gate/merger/AnnotationMergingMain.java
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
Modified: gate/trunk/plugins/Alignment/build.xml
===================================================================
--- gate/trunk/plugins/Alignment/build.xml 2014-03-15 02:21:50 UTC (rev
17666)
+++ gate/trunk/plugins/Alignment/build.xml 2014-03-15 08:57:17 UTC (rev
17667)
@@ -1,82 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="aligntools">
- <!-- Prevent Ant from warning about includeantruntime not being set -->
- <property name="build.sysclasspath" value="ignore" />
+ <!-- Prevent Ant from warning about includeantruntime not being set -->
+ <property name="build.sysclasspath" value="ignore" />
- <property name="jdk.home" value="${JAVA_HOME}"/>
- <property name="dest" value="classes"/>
- <property name="gatehome" value="../.."/>
- <property name="src" value="src"/>
- <property name="doc.dir" location="doc" />
- <property name="javadoc.dir" location="${doc.dir}/javadoc" />
+ <property name="jdk.home" value="${JAVA_HOME}"/>
+ <property name="dest" value="classes"/>
+ <property name="gatehome" value="../.."/>
+ <property name="src" value="src"/>
+ <property name="doc.dir" location="doc" />
+ <property name="javadoc.dir" location="${doc.dir}/javadoc" />
- <fileset id="gatelib.classpath" dir="${gatehome}/lib">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
+ <fileset id="gatelib.classpath" dir="${gatehome}/lib">
+ <include name="*.jar"/>
+ <include name="*.zip"/>
+ </fileset>
- <fileset id="gate.classpath" dir="${gatehome}/bin">
- <include name="*.jar"/>
- <include name="*.zip"/>
- </fileset>
+ <fileset id="gate.classpath" dir="${gatehome}/bin">
+ <include name="*.jar"/>
+ <include name="*.zip"/>
+ </fileset>
- <path id="compile.classpath">
- <fileset refid="gatelib.classpath"/>
- <fileset refid="gate.classpath"/>
- </path>
+ <path id="compile.classpath">
+ <fileset refid="gatelib.classpath"/>
+ <fileset refid="gate.classpath"/>
+ </path>
- <target name="jar" depends="compile">
- <jar compress="false" destfile="aligntools.jar">
- <fileset dir="${dest}"/>
- </jar>
- </target>
+ <target name="jar" depends="compile">
+ <jar compress="false" destfile="aligntools.jar">
+ <fileset dir="${dest}"/>
+ </jar>
+ </target>
- <target name="compile" depends="init">
- <javac classpathref="compile.classpath" source="1.5" target="1.5"
+ <target name="compile" depends="init">
+ <javac classpathref="compile.classpath" source="1.6"
target="1.6"
debug="true" deprecation="true" destdir="${dest}"
nowarn="false" encoding="UTF-8">
- <src path="${src}"/>
- </javac>
- </target>
+ <src path="${src}"/>
+ <compilerarg value="-Xmaxwarns" />
+ <compilerarg value="${gate.compile.maxwarnings}" />
+ <compilerarg value="-Xlint:all" />
+ </javac>
+ </target>
- <!-- Build JavaDoc documentation -->
- <target name="doc.prepare">
- <mkdir dir="${javadoc.dir}" />
- </target>
+ <!-- Build JavaDoc documentation -->
+ <target name="doc.prepare">
+ <mkdir dir="${javadoc.dir}" />
+ </target>
- <target name="javadoc" depends="doc.prepare">
- <javadoc destdir="${javadoc.dir}" packagenames="*"
+ <target name="javadoc" depends="doc.prepare">
+ <javadoc destdir="${javadoc.dir}" packagenames="*"
classpathref="compile.classpath"
encoding="UTF-8"
windowtitle="${plugin.name} JavaDoc"
source="1.6">
- <sourcepath>
- <pathelement location="${src}" />
- </sourcepath>
- <link href="http://docs.oracle.com/javase/6/docs/api/" />
- <link href="http://gate.ac.uk/gate/doc/javadoc/" />
- </javadoc>
- </target>
+ <sourcepath>
+ <pathelement location="${src}" />
+ </sourcepath>
+ <link href="http://docs.oracle.com/javase/6/docs/api/"
/>
+ <link href="http://gate.ac.uk/gate/doc/javadoc/" />
+ </javadoc>
+ </target>
- <target name="clean.classes">
- <delete failonerror="false" includeemptydirs="true">
- <fileset dir="${dest}"/>
- </delete>
- </target>
+ <target name="clean.classes">
+ <delete failonerror="false" includeemptydirs="true">
+ <fileset dir="${dest}"/>
+ </delete>
+ </target>
- <target name="clean" depends="clean.classes">
- <delete file="aligntools.jar"/>
- </target>
+ <target name="clean" depends="clean.classes">
+ <delete file="aligntools.jar"/>
+ </target>
- <target name="init">
- <mkdir dir="${dest}"/>
- </target>
+ <target name="init">
+ <mkdir dir="${dest}"/>
+ </target>
- <!-- targets required by the top-level build file -->
- <target name="build" depends="jar"/>
- <target name="distro.prepare" depends="clean.classes" />
- <target name="test" />
+ <!-- targets required by the top-level build file -->
+ <target name="build" depends="jar"/>
+ <target name="distro.prepare" depends="clean.classes" />
+ <target name="test" />
</project>
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentAction.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentAction.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentAction.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -1,13 +1,11 @@
package gate.alignment.gui;
-import java.util.Set;
import gate.Annotation;
-import gate.Document;
-import gate.alignment.Alignment;
import gate.alignment.AlignmentActionInitializationException;
import gate.alignment.AlignmentException;
-import gate.compound.CompoundDocument;
+import java.util.Set;
+
import javax.swing.Icon;
/**
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentActionsManager.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentActionsManager.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentActionsManager.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -47,12 +47,15 @@
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
+import org.apache.commons.io.IOUtils;
+
/**
* Alignment actions manager that allows managing actions that should be
* taken on various occasions.
* @author niraj
*
*/
+@SuppressWarnings("serial")
public class AlignmentActionsManager extends JPanel {
/**
@@ -169,7 +172,7 @@
// default actions conf file
ResourceData myResourceData =
- (ResourceData)Gate.getCreoleRegister().get(
+ Gate.getCreoleRegister().get(
CompoundDocumentImpl.class.getName());
URL creoleXml = myResourceData.getXmlFileUrl();
URL alignmentHomeURL = null;
@@ -421,8 +424,9 @@
private void readActions(File actionsConfFile) {
if(actionsConfFile != null && actionsConfFile.exists()) {
+ BufferedReader br = null;
try {
- BufferedReader br = new BufferedReader(new
FileReader(actionsConfFile));
+ br = new BufferedReader(new FileReader(actionsConfFile));
String line = br.readLine();
String cName = "";
while(line != null) {
@@ -438,7 +442,7 @@
cName = index < 0 ? line.trim() : line.substring(0, index);
line = index < 0 ? "" : line.substring(index + 1);
- Class actionClass =
+ Class<?> actionClass =
Class.forName(cName, true, Gate.getClassLoader());
Object action = actionClass.newInstance();
@@ -488,6 +492,9 @@
} catch(IOException ioe) {
throw new GateRuntimeException(ioe);
}
+ finally {
+ IOUtils.closeQuietly(br);
+ }
}
}
@@ -572,6 +579,7 @@
*
* @author gate
*/
+ @SuppressWarnings("unused")
private class PropertyActionCB extends JCheckBox {
/**
* Which action to call if the check box is selected
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentEditor.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentEditor.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentEditor.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -73,6 +73,7 @@
/**
* This class provides an editor for aligning texts in a compound document.
*/
+@SuppressWarnings("serial")
public class AlignmentEditor extends JFrame implements FeatureMapListener,
DocumentListener {
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentFactory.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentFactory.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/alignment/gui/AlignmentFactory.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -49,7 +49,6 @@
* sentences are already aligned)
* @throws Exception
*/
- @SuppressWarnings("unchecked")
public AlignmentFactory(CompoundDocument alignedDocument,
String srcDocumentId, String tgtDocumentId, String srcInputAS,
String tgtInputAS, String srcTokenAnnotationType,
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultDataModel.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultDataModel.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultDataModel.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -10,6 +10,7 @@
* @author niraj
*
*/
+@SuppressWarnings("serial")
public class DefaultDataModel extends AbstractTableModel {
/**
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultIteratingMethod.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultIteratingMethod.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/alignment/gui/DefaultIteratingMethod.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -33,6 +33,7 @@
*
* @author niraj
*/
+@SuppressWarnings("serial")
public class DefaultIteratingMethod implements IteratingMethod {
/**
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/actions/impl/AlignmentCache.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/alignment/gui/actions/impl/AlignmentCache.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/alignment/gui/actions/impl/AlignmentCache.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -21,7 +21,6 @@
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/LinksView.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/LinksView.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/LinksView.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -50,6 +50,7 @@
* This is a links view which shows pairs in horizontal mode and shows links
* among the highlight
*/
+@SuppressWarnings("serial")
public class LinksView extends JPanel implements AlignmentListener,
AlignmentView {
@@ -729,6 +730,7 @@
/**
* clears the local cache
*/
+ @SuppressWarnings("unused")
public boolean removeEdges(Edge e) {
return edges.remove(e);
}
@@ -771,16 +773,16 @@
for(Edge e : edges) {
int x =
- (int)(e.srcAH.getBounds().x + (double)((double)e.srcAH
+ (int)(e.srcAH.getBounds().x + ((double)e.srcAH
.getBounds().width / 2));
int y = 0;
int x1 =
- (int)(e.tgtAH.getBounds().x + (double)((double)e.tgtAH
+ (int)(e.tgtAH.getBounds().x + ((double)e.tgtAH
.getBounds().width / 2));
int y1 = this.getBounds().height;
Line2D line =
- new Line2D.Double(new Point((int)x, (int)y), new Point((int)x1,
- (int)y1));
+ new Line2D.Double(new Point(x, y), new Point(x1,
+ y1));
Stroke stroke = new BasicStroke(2.0f);
g2d.setStroke(stroke);
Color c = g2d.getColor();
@@ -834,7 +836,7 @@
super.fireTableDataChanged();
}
- public Class getColumnClass(int column) {
+ public Class<?> getColumnClass(int column) {
return String.class;
}
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/MatrixView.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/MatrixView.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/MatrixView.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -32,6 +32,7 @@
/**
* This class provides an editor for aligning texts in a compound document.
*/
+@SuppressWarnings("serial")
public class MatrixView extends JPanel implements AlignmentListener,
AlignmentView {
@@ -299,7 +300,7 @@
super.fireTableDataChanged();
}
- public Class getColumnClass(int column) {
+ public Class<?> getColumnClass(int column) {
return String.class;
}
Modified:
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/ParallelTextView.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/ParallelTextView.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/alignment/gui/views/ParallelTextView.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -49,6 +49,7 @@
/**
* This class provides an editor for aligning texts in a compound document.
*/
+@SuppressWarnings("serial")
public class ParallelTextView extends JPanel implements AlignmentListener,
AlignmentView {
@@ -783,7 +784,7 @@
super.fireTableDataChanged();
}
- public Class getColumnClass(int column) {
+ public Class<?> getColumnClass(int column) {
return String.class;
}
@@ -846,6 +847,7 @@
/**
* clears the local cache
*/
+ @SuppressWarnings("unused")
public boolean removeEdges(Edge e) {
return edges.remove(e);
}
@@ -888,16 +890,16 @@
for(Edge e : edges) {
int y =
- (int)(e.srcAH.getBounds().y + (double)((double)e.srcAH
+ (int)(e.srcAH.getBounds().y + ((double)e.srcAH
.getBounds().height / 2));
int x = 0;
int y1 =
- (int)(e.tgtAH.getBounds().y + (double)((double)e.tgtAH
+ (int)(e.tgtAH.getBounds().y + ((double)e.tgtAH
.getBounds().height / 2));
int x1 = this.getBounds().width;
Line2D line =
- new Line2D.Double(new Point((int)x, (int)y), new Point((int)x1,
- (int)y1));
+ new Line2D.Double(new Point(x, y), new Point(x1,
+ y1));
Stroke stroke = new BasicStroke(2.0f);
g2d.setStroke(stroke);
Color c = g2d.getColor();
Modified: gate/trunk/plugins/Alignment/src/gate/composite/CombiningMethod.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/composite/CombiningMethod.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/composite/CombiningMethod.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -23,7 +23,6 @@
* @param parameters
* @return
*/
- @SuppressWarnings("unchecked")
public CompositeDocument combine(CompoundDocument compoundDocument,
Map<String, Object> parameters) throws
CombiningMethodException;
Modified:
gate/trunk/plugins/Alignment/src/gate/composite/impl/AbstractCombiningMethod.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/composite/impl/AbstractCombiningMethod.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/composite/impl/AbstractCombiningMethod.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -38,6 +38,8 @@
*/
public abstract class AbstractCombiningMethod implements CombiningMethod {
+ private static final long serialVersionUID = -6866546515510128190L;
+
protected HashMap<String, List<OffsetDetails>> offsetMappings;
protected StringBuffer documentContent;
Modified:
gate/trunk/plugins/Alignment/src/gate/composite/impl/CombineFromAnnotID.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/composite/impl/CombineFromAnnotID.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/composite/impl/CombineFromAnnotID.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -38,7 +38,6 @@
* to copy none - otherwise the listed annotation types will be
* copied.
*/
- @SuppressWarnings("unchecked")
public CompositeDocument combine(CompoundDocument compoundDocument,
Map<String, Object> parameters) throws CombiningMethodException {
Modified:
gate/trunk/plugins/Alignment/src/gate/composite/impl/CompositeDocumentImpl.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/composite/impl/CompositeDocumentImpl.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/composite/impl/CompositeDocumentImpl.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -81,7 +81,7 @@
if(annotNames != null && !annotNames.isEmpty()) {
Iterator<String> iter = annotNames.iterator();
while(iter.hasNext()) {
- String asName = (String)iter.next();
+ String asName = iter.next();
this.getAnnotations(asName).addAnnotationSetListener(this);
}
}
@@ -343,12 +343,12 @@
as = getAnnotations();
}
else {
- Map ass = getNamedAnnotationSets();
+ Map<String,AnnotationSet> ass = getNamedAnnotationSets();
if(ass == null) return;
- Iterator namesIter = getNamedAnnotationSets().keySet().iterator();
+ Iterator<String> namesIter =
getNamedAnnotationSets().keySet().iterator();
while(namesIter.hasNext()) {
- String name = (String)namesIter.next();
- as = (AnnotationSet)getNamedAnnotationSets().get(name);
+ String name = namesIter.next();
+ as = getNamedAnnotationSets().get(name);
if(as.contains(annot)) {
break;
}
@@ -368,8 +368,9 @@
}
public void featureMapUpdated() {
- Map<Object, List<List<Integer>>> matches =
- (Map<Object,
List<List<Integer>>>)this.getFeatures().get("MatchesAnnots");
+ @SuppressWarnings("unchecked")
+ Map<String, List<List<Integer>>> matches =
+ (Map<String,
List<List<Integer>>>)this.getFeatures().get("MatchesAnnots");
if(matches == null) return;
for(List<List<Integer>> topList : matches.values()) {
for(List<Integer> list : topList) {
@@ -393,11 +394,12 @@
}
for(String docID : newList.keySet()) {
Document aDoc = compoundDocument.getDocument(docID);
- Map<Object, List<List<Integer>>> docMatches =
- (Map<Object, List<List<Integer>>>)aDoc.getFeatures().get(
+ @SuppressWarnings("unchecked")
+ Map<String, List<List<Integer>>> docMatches =
+ (Map<String, List<List<Integer>>>)aDoc.getFeatures().get(
"MatchesAnnots");
if(docMatches == null) {
- docMatches = new HashMap<Object, List<List<Integer>>>();
+ docMatches = new HashMap<String, List<List<Integer>>>();
aDoc.getFeatures().put("MatchesAnnots", docMatches);
}
Modified:
gate/trunk/plugins/Alignment/src/gate/composite/impl/DefaultCombiningMethod.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/composite/impl/DefaultCombiningMethod.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/composite/impl/DefaultCombiningMethod.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -51,7 +51,7 @@
* map.put("copyUnderlyingAnnotations","true");
*/
public CompositeDocument combine(CompoundDocument compoundDocument,
- Map parameters) throws CombiningMethodException {
+ Map<String,Object> parameters) throws CombiningMethodException {
try {
// parameters
Modified:
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/composite/impl/SegmentProcessingPR.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -42,6 +42,9 @@
*/
public class SegmentProcessingPR extends AbstractLanguageAnalyser implements
ProcessingResource {
+
+ private static final long serialVersionUID = 8528040629940314055L;
+
/**
* Controller that should be used to process segments.
*/
Modified: gate/trunk/plugins/Alignment/src/gate/compound/CompoundDocument.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/compound/CompoundDocument.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/compound/CompoundDocument.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -63,7 +63,7 @@
*
* @return
*/
- public Map getDocuments();
+ public Map<String,Document> getDocuments();
/**
* The method should return all document IDs
Modified:
gate/trunk/plugins/Alignment/src/gate/compound/gui/CompoundDocumentEditor.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/compound/gui/CompoundDocumentEditor.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/compound/gui/CompoundDocumentEditor.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -37,6 +37,7 @@
import java.util.Vector;
import javax.swing.AbstractAction;
+import javax.swing.Action;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
@@ -54,7 +55,7 @@
* document editors for all member documents of the compound document under
* a single component.
*/
-
+@SuppressWarnings("serial")
public class CompoundDocumentEditor extends AbstractVisualResource
implements
ActionsPublisher,
@@ -87,8 +88,8 @@
* The document view is just an empty shell. This method publishes the
* actions from the contained views.
*/
- public List getActions() {
- List actions = new ArrayList();
+ public List<Action> getActions() {
+ List<Action> actions = new ArrayList<Action>();
return actions;
}
@@ -134,13 +135,13 @@
*/
public void setHandle(Handle handle) {
super.setHandle(handle);
- Map documents = ((CompoundDocument)this.document).getDocuments();
+ Map<String,Document> documents =
((CompoundDocument)this.document).getDocuments();
((CompoundDocument)this.document).addCompoundDocumentListener(this);
- Iterator iter = documents.values().iterator();
+ Iterator<Document> iter = documents.values().iterator();
try {
while(iter.hasNext()) {
- Document doc = (Document)iter.next();
+ Document doc = iter.next();
NameBearerHandle nbHandle = new NameBearerHandle(doc, Main
.getMainFrame());
JComponent largeView = nbHandle.getLargeView();
@@ -172,7 +173,7 @@
public void actionPerformed(ActionEvent e) {
try {
// get all the documents loaded in the system
- java.util.List loadedDocuments = Gate.getCreoleRegister()
+ List<Resource> loadedDocuments = Gate.getCreoleRegister()
.getAllInstances("gate.Document");
if(loadedDocuments == null || loadedDocuments.isEmpty()) {
JOptionPane.showMessageDialog(CompoundDocumentEditor.this,
@@ -182,7 +183,7 @@
return;
}
- Vector docNames = new Vector();
+ Vector<String> docNames = new Vector<String>();
for(int i = 0; i < loadedDocuments.size(); i++) {
Document doc = (Document)loadedDocuments.get(i);
if(doc instanceof CompoundDocument) {
@@ -415,7 +416,7 @@
}
public void documentRemoved(CompoundDocumentEvent event) {
- Handle handle = (Handle)documentsMap.remove(event.getDocumentID());
+ Handle handle = documentsMap.remove(event.getDocumentID());
if(handle != null) {
tabbedPane.remove(handle.getLargeView());
tabbedPane.updateUI();
Modified:
gate/trunk/plugins/Alignment/src/gate/compound/impl/AbstractCompoundDocument.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/compound/impl/AbstractCompoundDocument.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/compound/impl/AbstractCompoundDocument.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -1,5 +1,6 @@
package gate.compound.impl;
+import gate.Annotation;
import gate.AnnotationSet;
import gate.DataStore;
import gate.Document;
@@ -381,7 +382,8 @@
* specified in the aSourceAnnotationSet. It is equivalent to
* toXml(aSourceAnnotationSet, true).
*/
- public String toXml(Set aSourceAnnotationSet) {
+ @Override
+ public String toXml(Set<Annotation> aSourceAnnotationSet) {
if(currentDocument == null) {
throw new GateRuntimeException(CURR_DOC_NOT_SET_MSG);
} else {
@@ -408,7 +410,7 @@
* @return a string representing an XML document containing the original
* markup + dumped annotations form the aSourceAnnotationSet
*/
- public String toXml(Set aSourceAnnotationSet, boolean includeFeatures) {
+ public String toXml(Set<Annotation> aSourceAnnotationSet, boolean
includeFeatures) {
if(currentDocument == null) {
throw new GateRuntimeException(CURR_DOC_NOT_SET_MSG);
} else {
@@ -544,7 +546,7 @@
} // toString
public void removeDocument(String documentID) {
- Document doc = (Document)documents.get(documentID);
+ Document doc = documents.get(documentID);
if(doc == null) return;
Factory.deleteResource(doc);
}
@@ -554,7 +556,8 @@
currentDocument.removeDocumentListener(l);
} else {
if(documentListeners != null && documentListeners.contains(l)) {
- Vector v = (Vector)documentListeners.clone();
+ @SuppressWarnings("unchecked")
+ Vector<DocumentListener> v =
(Vector<DocumentListener>)documentListeners.clone();
v.removeElement(l);
documentListeners = v;
}
@@ -565,10 +568,11 @@
if(currentDocument != null) {
currentDocument.addDocumentListener(l);
} else {
- Vector v =
+ @SuppressWarnings("unchecked")
+ Vector<DocumentListener> v =
documentListeners == null
? new Vector<DocumentListener>(2)
- : (Vector)documentListeners.clone();
+ : (Vector<DocumentListener>)documentListeners.clone();
if(!v.contains(l)) {
v.addElement(l);
documentListeners = v;
@@ -592,11 +596,11 @@
}
private void deleteAllDocs() {
- Set keys = documents.keySet();
- Iterator iter = keys.iterator();
+ Set<String> keys = documents.keySet();
+ Iterator<String> iter = keys.iterator();
while(iter.hasNext()) {
Object key = iter.next();
- Document doc = (Document)documents.get(key);
+ Document doc = documents.get(key);
Factory.deleteResource(doc);
}
}
@@ -667,7 +671,7 @@
}
}
- public Map getDocuments() {
+ public Map<String,Document> getDocuments() {
return documents;
}
Modified:
gate/trunk/plugins/Alignment/src/gate/compound/impl/AnnotationStream.java
===================================================================
--- gate/trunk/plugins/Alignment/src/gate/compound/impl/AnnotationStream.java
2014-03-15 02:21:50 UTC (rev 17666)
+++ gate/trunk/plugins/Alignment/src/gate/compound/impl/AnnotationStream.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -48,7 +48,7 @@
* annotations are sorted and returned in the specified
order.
*/
public AnnotationStream(Document doc, String annotationSet,
- String unitAnnotationType, String language, Comparator
comparator) {
+ String unitAnnotationType, String language,
Comparator<Annotation> comparator) {
this.doc = doc;
this.language = language;
this.annotationSet = annotationSet;
Modified:
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentFromXml.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentFromXml.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentFromXml.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -1,14 +1,11 @@
package gate.compound.impl;
-import gate.Document;
import gate.Factory;
import gate.FeatureMap;
import gate.Gate;
import gate.Resource;
import gate.alignment.Alignment;
import gate.creole.ResourceInstantiationException;
-import gate.creole.metadata.CreoleParameter;
-import gate.creole.metadata.CreoleResource;
import gate.util.BomStrippingInputStreamReader;
import gate.util.GateRuntimeException;
@@ -17,7 +14,6 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
@@ -27,6 +23,8 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.io.IOUtils;
+
/**
* Those compound documents saved in a single xml document can be
* reloaded in GATE using this LR.
@@ -48,9 +46,10 @@
"The compoundDocumentUrl is null.");
}
+ BufferedReader br = null;
try {
StringBuilder xmlString = new StringBuilder();
- BufferedReader br = new BomStrippingInputStreamReader(compoundDocumentUrl
+ br = new BomStrippingInputStreamReader(compoundDocumentUrl
.openStream(), getEncoding());
String line = br.readLine();
while(line != null) {
@@ -66,12 +65,16 @@
xstream.setClassLoader(Gate.getClassLoader());
// reading the xml object
+ @SuppressWarnings("unchecked")
Map<String, Object> globalMap = (HashMap<String, Object>)xstream
.fromXML(reader);
// now we read individual information
+ @SuppressWarnings("unchecked")
Map<String, String> docXmls = (HashMap<String, String>)globalMap
.get("docXmls");
+
+ @SuppressWarnings("unchecked")
Map<String, Object> features = (Map<String, Object>)globalMap
.get("feats");
@@ -133,6 +136,9 @@
catch(IOException ioe) {
throw new ResourceInstantiationException(ioe);
}
+ finally {
+ IOUtils.closeQuietly(br);
+ }
return this;
} // init()
Modified:
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentImpl.java
===================================================================
---
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentImpl.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Alignment/src/gate/compound/impl/CompoundDocumentImpl.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -138,7 +138,7 @@
for(int i = 0; i < documentIDs.size(); i++) {
// apart from the index, we need to search for all other files
// create file Name
- documentID = (String)documentIDs.get(i);
+ documentID = documentIDs.get(i);
String fileNameToSearch = file.getParentFile().getAbsolutePath() + "/"
+ name + "." + documentID + extension;
File newFile = new File(fileNameToSearch);
@@ -229,7 +229,7 @@
public void fireDocumentAdded(String documentID) {
CompoundDocumentEvent cde = new CompoundDocumentEvent(this, documentID);
for(int i = 0; i < listeners.size(); i++) {
- CompoundDocumentListener cdl =
(CompoundDocumentListener)listeners.get(i);
+ CompoundDocumentListener cdl = listeners.get(i);
cdl.documentAdded(cde);
}
}
@@ -242,7 +242,7 @@
public void fireDocumentRemoved(String documentID) {
CompoundDocumentEvent cde = new CompoundDocumentEvent(this, documentID);
for(int i = 0; i < listeners.size(); i++) {
- CompoundDocumentListener cdl =
(CompoundDocumentListener)listeners.get(i);
+ CompoundDocumentListener cdl = listeners.get(i);
cdl.documentRemoved(cde);
}
}
Modified: gate/trunk/plugins/Annotation_Merging/build.xml
===================================================================
--- gate/trunk/plugins/Annotation_Merging/build.xml 2014-03-15 02:21:50 UTC
(rev 17666)
+++ gate/trunk/plugins/Annotation_Merging/build.xml 2014-03-15 08:57:17 UTC
(rev 17667)
@@ -84,7 +84,11 @@
<!-- This target compiles all the classes -->
<target name="compile" description="compile the source "
depends="prepare">
<!-- Compile the java code from ${srcDir} into ${buildDir} -->
- <javac srcdir="${srcDir}" destdir="${buildDir}" source="1.5"
target="1.5" encoding="UTF-8" debug="true" debuglevel="lines,source"
classpathref="build.class.path" />
+ <javac srcdir="${srcDir}" destdir="${buildDir}" source="1.6"
target="1.6" encoding="UTF-8" debug="true" debuglevel="lines,source"
classpathref="build.class.path">
+ <compilerarg value="-Xmaxwarns" />
+ <compilerarg value="${gate.compile.maxwarnings}" />
+ <compilerarg value="-Xlint:all" />
+ </javac>
</target>
<target name="jar" depends="compile">
Modified:
gate/trunk/plugins/Annotation_Merging/src/gate/merger/AnnotationMergingMain.java
===================================================================
---
gate/trunk/plugins/Annotation_Merging/src/gate/merger/AnnotationMergingMain.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Annotation_Merging/src/gate/merger/AnnotationMergingMain.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -1,7 +1,5 @@
package gate.merger;
-import java.util.*;
-
import gate.Annotation;
import gate.AnnotationSet;
import gate.Factory;
@@ -11,11 +9,20 @@
import gate.creole.ExecutionException;
import gate.creole.ResourceInstantiationException;
import gate.util.AnnotationMerging;
-//import gate.util.IaaCalculation;
import gate.util.InvalidOffsetException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+//import gate.util.IaaCalculation;
+
public class AnnotationMergingMain extends AbstractLanguageAnalyser implements
ProcessingResource {
+
+ private static final long serialVersionUID = -5149313306167125053L;
+
/** Annotation sets for merging in one document. */
private String annSetsForMerging;
Modified:
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
===================================================================
---
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
2014-03-15 02:21:50 UTC (rev 17666)
+++
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
2014-03-15 08:57:17 UTC (rev 17667)
@@ -100,7 +100,7 @@
MergingMethodsEnum methodMerger = MergingMethodsEnum.MajorityVoting;
mergerOne.setMergingMethod(methodMerger);
controller.execute();
- Document doc = (Document)corpus.get(0);
+ Document doc = corpus.get(0);
AnnotationSet anns = doc.getAnnotations("mergerAnns").get("sent");
int num = obtainAnns(anns, "Op", "true");
assertEquals(num, 5);
@@ -113,7 +113,7 @@
mergerOne.setMergingMethod(methodMerger);
mergerOne.setMinimalAnnNum("3");
controller.execute();
- doc = (Document)corpus.get(0);
+ doc = corpus.get(0);
anns = doc.getAnnotations("mergerAnns").get("sent");
num = obtainAnns(anns, "Op", "true");
assertEquals(num, 4);
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