Revision: 17558
          http://sourceforge.net/p/gate/code/17558
Author:   markagreenwood
Date:     2014-03-06 12:57:18 +0000 (Thu, 06 Mar 2014)
Log Message:
-----------
a little more generics clean up

Modified Paths:
--------------
    gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java
    gate/trunk/src/main/gate/annotation/EventAwareAnnotationSet.java
    gate/trunk/src/main/gate/annotation/NodeImpl.java

Modified: gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java  2014-03-06 
12:39:04 UTC (rev 17557)
+++ gate/trunk/src/main/gate/annotation/AnnotationSetImpl.java  2014-03-06 
12:57:18 UTC (rev 17558)
@@ -289,6 +289,7 @@
         return;
       }
       // otherwise it is a Collection
+      @SuppressWarnings("unchecked")
       Collection<Annotation> starterAnnots = 
(Collection<Annotation>)objectAtNode;
       starterAnnots.remove(a);
       // if there is only one annotation left
@@ -407,7 +408,7 @@
 
   /** Select annotations by type and feature names */
   @Override
-  public AnnotationSet get(String type, Set featureNames) {
+  public AnnotationSet get(String type, Set<? extends Object> featureNames) {
     if(annotsByType == null) indexByType();
     AnnotationSet typeSet = null;
     if(type != null) {
@@ -948,6 +949,7 @@
    * Add an annotation to the start offset index. Does nothing if the index
    * doesn't exist.
    */
+  @SuppressWarnings("unchecked")
   void addToStartOffsetIndex(Annotation a) {
     Node startNode = a.getStartNode();
     Node endNode = a.getEndNode();
@@ -1161,6 +1163,7 @@
    * hashmap can be Annotations or a Collection of Annotations. Returns null if
    * there are no Annotations at that position
    */
+  @SuppressWarnings("unchecked")
   private final Collection<Annotation> getAnnotsByStartNode(Integer id) {
     Object objFromPoint = annotsByStartNode.get(id);
     if(objFromPoint == null) return null;
@@ -1187,6 +1190,7 @@
   @Override
   public synchronized void removeAnnotationSetListener(AnnotationSetListener 
l) {
     if(annotationSetListeners != null && annotationSetListeners.contains(l)) {
+      @SuppressWarnings("unchecked")
       Vector<AnnotationSetListener> v = 
(Vector<AnnotationSetListener>)annotationSetListeners.clone();
       v.removeElement(l);
       annotationSetListeners = v;
@@ -1195,6 +1199,7 @@
 
   @Override
   public synchronized void addAnnotationSetListener(AnnotationSetListener l) {
+    @SuppressWarnings("unchecked")
     Vector<AnnotationSetListener> v = annotationSetListeners == null
             ? new Vector<AnnotationSetListener>(2)
             : (Vector<AnnotationSetListener>)annotationSetListeners.clone();
@@ -1227,6 +1232,7 @@
   @Override
   public synchronized void removeGateListener(GateListener l) {
     if(gateListeners != null && gateListeners.contains(l)) {
+      @SuppressWarnings("unchecked")
       Vector<GateListener> v = (Vector<GateListener>)gateListeners.clone();
       v.removeElement(l);
       gateListeners = v;
@@ -1235,6 +1241,7 @@
 
   @Override
   public synchronized void addGateListener(GateListener l) {
+    @SuppressWarnings("unchecked")
     Vector<GateListener> v = gateListeners == null ? new 
Vector<GateListener>(2) : (Vector<GateListener>)gateListeners
             .clone();
     if(!v.contains(l)) {
@@ -1290,6 +1297,7 @@
     this.annotations = (Annotation[])gf.get("annotations", null);
     if(this.annotations == null) {
       // old style serialised version
+      @SuppressWarnings("unchecked")
       Map<Integer, Annotation> annotsByIdMap = (Map<Integer, Annotation>)gf
               .get("annotsById", null);
       if(annotsByIdMap == null)

Modified: gate/trunk/src/main/gate/annotation/EventAwareAnnotationSet.java
===================================================================
--- gate/trunk/src/main/gate/annotation/EventAwareAnnotationSet.java    
2014-03-06 12:39:04 UTC (rev 17557)
+++ gate/trunk/src/main/gate/annotation/EventAwareAnnotationSet.java    
2014-03-06 12:57:18 UTC (rev 17558)
@@ -17,18 +17,19 @@
 
 package gate.annotation;
 
+import gate.Annotation;
+import gate.AnnotationSet;
+
 import java.util.Collection;
 
-import gate.AnnotationSet;
 
 
-
 public interface EventAwareAnnotationSet extends AnnotationSet {
 
-  public Collection getAddedAnnotations();
+  public Collection<Annotation> getAddedAnnotations();
 
-  public Collection getChangedAnnotations();
+  public Collection<Annotation> getChangedAnnotations();
 
-  public Collection getRemovedAnnotations();
+  public Collection<Annotation> getRemovedAnnotations();
 
 }
\ No newline at end of file

Modified: gate/trunk/src/main/gate/annotation/NodeImpl.java
===================================================================
--- gate/trunk/src/main/gate/annotation/NodeImpl.java   2014-03-06 12:39:04 UTC 
(rev 17557)
+++ gate/trunk/src/main/gate/annotation/NodeImpl.java   2014-03-06 12:57:18 UTC 
(rev 17558)
@@ -21,7 +21,7 @@
 /** Provides an implementation for the interface gate.Node.
  *
  */
-public class NodeImpl implements Node, Comparable
+public class NodeImpl implements Node, Comparable<Node>
 {
   /** Debug flag
    */
@@ -68,8 +68,7 @@
   /** Ordering
    */
   @Override
-  public int compareTo(Object o) throws ClassCastException {
-    Node other = (Node) o;
+  public int compareTo(Node other) throws ClassCastException {
     return id.compareTo(other.getId());
   } // compareTo
 

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