Revision: 17557
          http://sourceforge.net/p/gate/code/17557
Author:   markagreenwood
Date:     2014-03-06 12:39:04 +0000 (Thu, 06 Mar 2014)
Log Message:
-----------
some more generics including fixing something I messed up earlier

Modified Paths:
--------------
    gate/trunk/src/main/gate/DataStore.java
    gate/trunk/src/main/gate/annotation/AnnotationImpl.java
    gate/trunk/src/main/gate/gui/ResourceHelper.java
    gate/trunk/src/main/gate/persist/SerialDataStore.java
    gate/trunk/src/test/gate/creole/TestPR.java

Modified: gate/trunk/src/main/gate/DataStore.java
===================================================================
--- gate/trunk/src/main/gate/DataStore.java     2014-03-06 12:33:47 UTC (rev 
17556)
+++ gate/trunk/src/main/gate/DataStore.java     2014-03-06 12:39:04 UTC (rev 
17557)
@@ -103,7 +103,7 @@
   throws PersistenceException,SecurityException;
 
   /** Get a list of the types of LR that are present in the data store. */
-  public List<LanguageResource> getLrTypes() throws PersistenceException;
+  public List<String> getLrTypes() throws PersistenceException;
 
   /** Get a list of the IDs of LRs of a particular type that are present. */
   public List<String> getLrIds(String lrType) throws PersistenceException;

Modified: gate/trunk/src/main/gate/annotation/AnnotationImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/AnnotationImpl.java     2014-03-06 
12:33:47 UTC (rev 17556)
+++ gate/trunk/src/main/gate/annotation/AnnotationImpl.java     2014-03-06 
12:39:04 UTC (rev 17557)
@@ -399,7 +399,7 @@
    *   <LI> FEATURES_UPDATED event
    * </UL>
    */
-  private transient Vector annotationListeners;
+  private transient Vector<AnnotationListener> annotationListeners;
   /**
    * The listener for the events coming from the features.
    */
@@ -413,7 +413,8 @@
   @Override
   public synchronized void removeAnnotationListener(AnnotationListener l) {
     if (annotationListeners != null && annotationListeners.contains(l)) {
-      Vector v = (Vector) annotationListeners.clone();
+      @SuppressWarnings("unchecked")
+      Vector<AnnotationListener> v = (Vector<AnnotationListener>) 
annotationListeners.clone();
       v.removeElement(l);
       annotationListeners = v;
     }
@@ -424,7 +425,8 @@
    */
   @Override
   public synchronized void addAnnotationListener(AnnotationListener l) {
-    Vector v = annotationListeners == null ? new Vector(2) : (Vector) 
annotationListeners.clone();
+    @SuppressWarnings("unchecked")
+    Vector<AnnotationListener> v = annotationListeners == null ? new 
Vector<AnnotationListener>(2) : (Vector<AnnotationListener>) 
annotationListeners.clone();
 
     //now check and if this is the first listener added,
     //start listening to all features, so their changes can
@@ -447,10 +449,10 @@
    */
   protected void fireAnnotationUpdated(AnnotationEvent e) {
     if (annotationListeners != null) {
-      Vector listeners = annotationListeners;
+      Vector<AnnotationListener> listeners = annotationListeners;
       int count = listeners.size();
       for (int i = 0; i < count; i++) {
-        ((AnnotationListener) listeners.elementAt(i)).annotationUpdated(e);
+        listeners.elementAt(i).annotationUpdated(e);
       }
     }
   }//fireAnnotationUpdated

Modified: gate/trunk/src/main/gate/gui/ResourceHelper.java
===================================================================
--- gate/trunk/src/main/gate/gui/ResourceHelper.java    2014-03-06 12:33:47 UTC 
(rev 17556)
+++ gate/trunk/src/main/gate/gui/ResourceHelper.java    2014-03-06 12:39:04 UTC 
(rev 17557)
@@ -17,6 +17,7 @@
 import gate.Gate;
 import gate.Resource;
 import gate.creole.AbstractResource;
+import gate.creole.ResourceInstantiationException;
 import gate.event.CreoleEvent;
 import gate.event.CreoleListener;
 
@@ -40,7 +41,7 @@
   Map<Object, List<Action>> actions = new HashMap<Object, List<Action>>();
 
   @Override
-  public Resource init() {
+  public Resource init() throws ResourceInstantiationException{
     // we need to listen for unload events so we register ourselves with the
     // creole register
     Gate.getCreoleRegister().addCreoleListener(this);

Modified: gate/trunk/src/main/gate/persist/SerialDataStore.java
===================================================================
--- gate/trunk/src/main/gate/persist/SerialDataStore.java       2014-03-06 
12:33:47 UTC (rev 17556)
+++ gate/trunk/src/main/gate/persist/SerialDataStore.java       2014-03-06 
12:39:04 UTC (rev 17557)
@@ -506,13 +506,13 @@
 
   /** Get a list of the types of LR that are present in the data store. */
   @Override
-  public List getLrTypes() throws PersistenceException {
+  public List<String> getLrTypes() throws PersistenceException {
     if(storageDir == null || ! storageDir.exists())
       throw new PersistenceException("Can't read storage directory");
 
     // filter out the version file
     String[] fileArray = filterIgnoredFileNames(storageDir.list());
-    List lrTypes = new ArrayList();
+    List<String> lrTypes = new ArrayList<String>();
     for(int i=0; i<fileArray.length; i++)
       if(! fileArray[i].equals(versionFileName))
         lrTypes.add(fileArray[i]);

Modified: gate/trunk/src/test/gate/creole/TestPR.java
===================================================================
--- gate/trunk/src/test/gate/creole/TestPR.java 2014-03-06 12:33:47 UTC (rev 
17556)
+++ gate/trunk/src/test/gate/creole/TestPR.java 2014-03-06 12:39:04 UTC (rev 
17557)
@@ -502,8 +502,7 @@
                      storageDir.toExternalForm());
 
     //get LR id
-    String lrId = (String)ds.getLrIds
-                                ("gate.corpora.DocumentImpl").get(0);
+    String lrId = ds.getLrIds("gate.corpora.DocumentImpl").get(0);
 
 
     // get the document from data store
@@ -523,7 +522,7 @@
     ds = Factory.openDataStore("gate.persist.SerialDataStore",
                                storageDir.toExternalForm());
     //get LR id
-    lrId = (String)ds.getLrIds("gate.corpora.DocumentImpl").get(0);
+    lrId = ds.getLrIds("gate.corpora.DocumentImpl").get(0);
     // get the document from data store
     features = Factory.newFeatureMap();
     features.put(DataStore.DATASTORE_FEATURE_NAME, ds);
@@ -541,7 +540,7 @@
     ds = Factory.openDataStore("gate.persist.SerialDataStore",
                                storageDir.toExternalForm());
     //get LR id
-    lrId = (String)ds.getLrIds("gate.corpora.DocumentImpl").get(0);
+    lrId = ds.getLrIds("gate.corpora.DocumentImpl").get(0);
     // get the document from data store
     features = Factory.newFeatureMap();
     features.put(DataStore.DATASTORE_FEATURE_NAME, ds);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to