Revision: 14728
http://gate.svn.sourceforge.net/gate/?rev=14728&view=rev
Author: markagreenwood
Date: 2011-12-11 13:13:32 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
fixed a few more FindBugs issues
Modified Paths:
--------------
gate/trunk/src/gate/creole/gazetteer/DefaultGazetteer.java
gate/trunk/src/gate/gui/annedit/SchemaFeaturesEditor.java
gate/trunk/src/gate/persist/TestPersist.java
Modified: gate/trunk/src/gate/creole/gazetteer/DefaultGazetteer.java
===================================================================
--- gate/trunk/src/gate/creole/gazetteer/DefaultGazetteer.java 2011-12-11
10:28:41 UTC (rev 14727)
+++ gate/trunk/src/gate/creole/gazetteer/DefaultGazetteer.java 2011-12-11
13:13:32 UTC (rev 14728)
@@ -17,11 +17,25 @@
*/
package gate.creole.gazetteer;
-import java.util.*;
+import gate.AnnotationSet;
+import gate.Factory;
+import gate.FeatureMap;
+import gate.Resource;
+import gate.Utils;
+import gate.creole.CustomDuplication;
+import gate.creole.ExecutionException;
+import gate.creole.ExecutionInterruptedException;
+import gate.creole.ResourceInstantiationException;
+import gate.util.GateRuntimeException;
+import gate.util.InvalidOffsetException;
+import gate.util.Strings;
-import gate.*;
-import gate.creole.*;
-import gate.util.*;
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
/** This component is responsible for doing lists lookup. The implementation is
* based on finite state machines.
@@ -505,7 +519,7 @@
* class implementing the map using binary search by char as key
* to retrieve the corresponding object.
*/
- public static class CharMap
+ public static class CharMap implements Serializable
{
char[] itemsKeys = null;
Object[] itemsObjs = null;
Modified: gate/trunk/src/gate/gui/annedit/SchemaFeaturesEditor.java
===================================================================
--- gate/trunk/src/gate/gui/annedit/SchemaFeaturesEditor.java 2011-12-11
10:28:41 UTC (rev 14727)
+++ gate/trunk/src/gate/gui/annedit/SchemaFeaturesEditor.java 2011-12-11
13:13:32 UTC (rev 14728)
@@ -7,7 +7,7 @@
* Version 2, June 1991 (in the distribution as file licence.html,
* and also available at http://gate.ac.uk/gate/licence.html).
*
- * AbstractDocumentView.java
+ * SchemaFeaturesEditor.java
*
* Valentin Tablan, Sep 11, 2007
*
@@ -15,41 +15,31 @@
*/
package gate.gui.annedit;
-import gate.Factory;
import gate.FeatureMap;
import gate.creole.AnnotationSchema;
import gate.creole.FeatureSchema;
-import gate.creole.ResourceInstantiationException;
import gate.swing.JChoice;
-import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
-import java.awt.HeadlessException;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.io.File;
-import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
-import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.JToolBar;
import javax.swing.border.Border;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
@@ -437,65 +427,7 @@
}
initGui();
}
-
- public static void main(String[] args){
- try {
- JFrame aFrame = new JFrame("New Annotation Editor");
-
- AnnotationSchema aSchema = new AnnotationSchema();
- aSchema.setXmlFileUrl(new
File("/home/valyt/tmp/bug/schema.xml").toURI().toURL());
- aSchema.init();
-
- final SchemaFeaturesEditor fsEditor = new SchemaFeaturesEditor(aSchema);
-
- aFrame.getContentPane().add(fsEditor, BorderLayout.CENTER);
- aFrame.pack();
- aFrame.setVisible(true);
-
- JToolBar tBar = new JToolBar();
- tBar.add(new AbstractAction("New Values!"){
- /* (non-Javadoc)
- * @see
java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
- FeatureMap fMap = Factory.newFeatureMap();
-
- fMap.put("boolean-false", new Boolean(true));
- fMap.put("boolean-true", new Boolean(false));
- fMap.put("nominal-long", "val10");
- fMap.put("nominal-short", "val6");
- fMap.put("free-text", "New text!");
- fsEditor.editFeatureMap(fMap);
-
- }
- });
-
- tBar.add(new AbstractAction("Null Values!"){
- /* (non-Javadoc)
- * @see
java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e) {
- fsEditor.editFeatureMap(null);
-
- }
- });
- aFrame.getContentPane().add(tBar, BorderLayout.NORTH);
-
-
- }
- catch(HeadlessException e) {
- e.printStackTrace();
- }
- catch(MalformedURLException e) {
- e.printStackTrace();
- }
- catch(ResourceInstantiationException e) {
- e.printStackTrace();
- }
-
- }
-
protected void initGui(){
setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
Modified: gate/trunk/src/gate/persist/TestPersist.java
===================================================================
--- gate/trunk/src/gate/persist/TestPersist.java 2011-12-11 10:28:41 UTC
(rev 14727)
+++ gate/trunk/src/gate/persist/TestPersist.java 2011-12-11 13:13:32 UTC
(rev 14728)
@@ -1728,13 +1728,33 @@
this.floatValue = _float;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (boolValue ? 1231 : 1237);
+ result = prime * result + Float.floatToIntBits(floatValue);
+ result = prime * result + intValue;
+ result =
+ prime * result
+ + ((stringValue == null) ? 0 : stringValue.hashCode());
+ return result;
+ }
+
+ @Override
public boolean equals(Object obj) {
- Dummy d2 = (Dummy)obj;
-
- return this.intValue == d2.intValue &&
- this.stringValue.equals(d2.stringValue) &&
- this.boolValue == d2.boolValue &&
- this.floatValue == d2.floatValue;
+ if(this == obj) return true;
+ if(obj == null) return false;
+ if(getClass() != obj.getClass()) return false;
+ Dummy other = (Dummy)obj;
+ if(boolValue != other.boolValue) return false;
+ if(Float.floatToIntBits(floatValue) != Float
+ .floatToIntBits(other.floatValue)) return false;
+ if(intValue != other.intValue) return false;
+ if(stringValue == null) {
+ if(other.stringValue != null) return false;
+ } else if(!stringValue.equals(other.stringValue)) return false;
+ return true;
}
public String toString() {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs