Revision: 17494
          http://sourceforge.net/p/gate/code/17494
Author:   markagreenwood
Date:     2014-03-01 10:23:29 +0000 (Sat, 01 Mar 2014)
Log Message:
-----------
more generics cleanup and I've spotted some missing code that will need fixing 
before I get to the equality stuff

Modified Paths:
--------------
    gate/trunk/plugins/WordNet/src/gate/wordnet/IndexFileWordNetImpl.java
    gate/trunk/plugins/WordNet/src/gate/wordnet/JWNLWordNetImpl.java
    gate/trunk/plugins/WordNet/src/gate/wordnet/SynsetImpl.java
    gate/trunk/plugins/WordNet/src/gate/wordnet/VerbImpl.java
    gate/trunk/plugins/WordNet/src/gate/wordnet/WordImpl.java
    gate/trunk/plugins/WordNet/src/gate/wordnet/WordSenseImpl.java
    gate/trunk/src/main/gate/wordnet/WordNet.java

Modified: gate/trunk/plugins/WordNet/src/gate/wordnet/IndexFileWordNetImpl.java
===================================================================
--- gate/trunk/plugins/WordNet/src/gate/wordnet/IndexFileWordNetImpl.java       
2014-03-01 09:49:01 UTC (rev 17493)
+++ gate/trunk/plugins/WordNet/src/gate/wordnet/IndexFileWordNetImpl.java       
2014-03-01 10:23:29 UTC (rev 17494)
@@ -23,6 +23,8 @@
 
 public class IndexFileWordNetImpl extends AbstractLanguageResource {
 
+  private static final long serialVersionUID = 3188799675277115628L;
+
   public void setPropertyUrl(URL u) {
     // ignore this
   }

Modified: gate/trunk/plugins/WordNet/src/gate/wordnet/JWNLWordNetImpl.java
===================================================================
--- gate/trunk/plugins/WordNet/src/gate/wordnet/JWNLWordNetImpl.java    
2014-03-01 09:49:01 UTC (rev 17493)
+++ gate/trunk/plugins/WordNet/src/gate/wordnet/JWNLWordNetImpl.java    
2014-03-01 10:23:29 UTC (rev 17494)
@@ -29,10 +29,10 @@
 import gate.util.GateRuntimeException;
 import gate.util.MethodNotImplementedException;
 
-
 public class JWNLWordNetImpl extends AbstractLanguageResource
                                   implements WordNet {
 
+  private static final long serialVersionUID = 6093935311124581444L;
 
   /** JWNL dictionary */
   private Dictionary wnDictionary;
@@ -97,15 +97,14 @@
   }
 
   /** returns all synsets for specific POS */
-  public Iterator getSynsets(int _pos)
+  public Iterator<Synset> getSynsets(int _pos)
     throws WordNetException {
 
     net.didion.jwnl.data.POS pos = WNHelper.int2POS(_pos);
 
     try {
-      net.didion.jwnl.data.Synset jwnSynset = null;
-
-      Iterator itSynsets = this.wnDictionary.getSynsetIterator(pos);
+      @SuppressWarnings("unchecked")
+      Iterator<net.didion.jwnl.data.Synset> itSynsets = 
this.wnDictionary.getSynsetIterator(pos);
       return new SynsetIterator(itSynsets);
     }
     catch(JWNLException jwne) {
@@ -115,7 +114,7 @@
   }
 
   /** returns all unique beginners */
-  public Iterator getUniqueBeginners() {
+  public Iterator<Synset> getUniqueBeginners() {
     throw new MethodNotImplementedException();
   }
 
@@ -180,7 +179,7 @@
 
 
   /** returns list of WordSense-s for specific lemma */
-  public List lookupWord(String lemma) throws WordNetException {
+  public List<WordSense> lookupWord(String lemma) throws WordNetException {
 
     try {
       IndexWord[] jwIndexWordArr = 
this.wnDictionary.lookupAllIndexWords(lemma).getIndexWordArray();
@@ -192,7 +191,7 @@
   }
 
   /** returns list of WordSense-s for specific lemma of the specified POS */
-  public List lookupWord(String lemma, int pos) throws WordNetException {
+  public List<WordSense> lookupWord(String lemma, int pos) throws 
WordNetException {
 
     try {
       IndexWord jwIndexWord = 
this.wnDictionary.lookupIndexWord(WNHelper.int2POS(pos), lemma);
@@ -200,7 +199,7 @@
       //do we have a word with this POS?
       if (null == jwIndexWord) {
         //return dummy
-        return new ArrayList();
+        return new ArrayList<WordSense>();
       }
 
       IndexWord[] jwIndexWordArr = new IndexWord[1];
@@ -214,9 +213,9 @@
   }
 
   /** helper method */
-  private List _lookupWord(String lemma, IndexWord[] jwIndexWords) throws 
WordNetException{
+  private List<WordSense> _lookupWord(String lemma, IndexWord[] jwIndexWords) 
throws WordNetException{
 
-    List result = new ArrayList();
+    List<WordSense> result = new ArrayList<WordSense>();
 
     try {
       for (int i=0; i< jwIndexWords.length; i++) {
@@ -227,9 +226,9 @@
           net.didion.jwnl.data.Synset jwSynset = jwSynsetArr[j];
           Synset gateSynset = new SynsetImpl(jwSynset,this.wnDictionary);
           //find the word of interest
-          List wordSenses = gateSynset.getWordSenses();
+          List<WordSense> wordSenses = gateSynset.getWordSenses();
 
-          Iterator itSenses = wordSenses.iterator();
+          Iterator<WordSense> itSenses = wordSenses.iterator();
           while (itSenses.hasNext()) {
             WordSense currSynsetMember = (WordSense)itSenses.next();
             if (currSynsetMember.getWord().getLemma().equalsIgnoreCase(lemma)) 
{
@@ -249,11 +248,11 @@
   }
 
   /** iterator for synsets - may load synsets when necessary, not all at once 
*/
-  class SynsetIterator implements java.util.Iterator {
+  class SynsetIterator implements java.util.Iterator<Synset> {
 
-    private Iterator it;
+    private Iterator<net.didion.jwnl.data.Synset> it;
 
-    public SynsetIterator(Iterator _it) {
+    public SynsetIterator(Iterator<net.didion.jwnl.data.Synset> _it) {
 
       Assert.assertNotNull(_it);
       this.it = _it;
@@ -267,9 +266,9 @@
       throw new UnsupportedOperationException();
     }
 
-    public Object next() {
+    public Synset next() {
 
-      net.didion.jwnl.data.Synset jwnlSynset = 
(net.didion.jwnl.data.Synset)this.it.next();
+      net.didion.jwnl.data.Synset jwnlSynset = this.it.next();
       Synset gateSynset = new SynsetImpl(jwnlSynset, wnDictionary);
       return gateSynset;
     }

Modified: gate/trunk/plugins/WordNet/src/gate/wordnet/SynsetImpl.java
===================================================================
--- gate/trunk/plugins/WordNet/src/gate/wordnet/SynsetImpl.java 2014-03-01 
09:49:01 UTC (rev 17493)
+++ gate/trunk/plugins/WordNet/src/gate/wordnet/SynsetImpl.java 2014-03-01 
10:23:29 UTC (rev 17494)
@@ -28,8 +28,8 @@
 
 public class SynsetImpl implements Synset {
 
-  private ArrayList wordSenses;
-  private ArrayList semRelations;
+  private List<WordSense> wordSenses;
+  private List<SemanticRelation> semRelations;
   private String gloss;
   private int synsetPOS;
   Dictionary wnDictionary;
@@ -54,7 +54,7 @@
 
     //word senses
     net.didion.jwnl.data.Word[] synsetWords = jwSynset.getWords();
-    this.wordSenses = new ArrayList(synsetWords.length);
+    this.wordSenses = new ArrayList<WordSense>(synsetWords.length);
 
     for (int i= 0; i< synsetWords.length; i++) {
 
@@ -126,7 +126,7 @@
 
   /** is this synset a UB - i.e. has no hypernym */
   public boolean isUniqueBeginner() throws WordNetException {
-    List parents = getSemanticRelations(Relation.REL_HYPERNYM);
+    List<SemanticRelation> parents = 
getSemanticRelations(Relation.REL_HYPERNYM);
     return parents.isEmpty();
   }
 
@@ -137,7 +137,7 @@
 
 
   /** WordSenses contained in this synset */
-  public List getWordSenses(){
+  public List<WordSense> getWordSenses(){
     return this.wordSenses;
   }
 
@@ -149,7 +149,7 @@
 
 
   /** get the SemanticRelation-s of this synset */
-  public List getSemanticRelations() throws WordNetException{
+  public List<SemanticRelation> getSemanticRelations() throws WordNetException{
 
     if (null == this.semRelations) {
       _loadSemanticRelations();
@@ -159,15 +159,15 @@
   }
 
   /** get the SemanticRelation-s of specific type (HYPERNYm) for this synset */
-  public List getSemanticRelations(int type) throws WordNetException{
+  public List<SemanticRelation> getSemanticRelations(int type) throws 
WordNetException{
 
-    List result = new ArrayList(1);
+    List<SemanticRelation> result = new ArrayList<SemanticRelation>(1);
 
     if (null == this.semRelations) {
       _loadSemanticRelations();
     }
 
-    Iterator it = this.semRelations.iterator();
+    Iterator<SemanticRelation> it = this.semRelations.iterator();
     while (it.hasNext()) {
       SemanticRelation sRel = (SemanticRelation)it.next();
       Assert.assertNotNull(sRel);
@@ -190,7 +190,7 @@
       Assert.assertNotNull(jwSynset);
       Pointer[] jwPointers = jwSynset.getPointers();
 
-      this.semRelations = new ArrayList(jwPointers.length);
+      this.semRelations = new ArrayList<SemanticRelation>(jwPointers.length);
 
       for (int i= 0; i< jwPointers.length; i++) {
         Pointer currPointer = jwPointers[i];

Modified: gate/trunk/plugins/WordNet/src/gate/wordnet/VerbImpl.java
===================================================================
--- gate/trunk/plugins/WordNet/src/gate/wordnet/VerbImpl.java   2014-03-01 
09:49:01 UTC (rev 17493)
+++ gate/trunk/plugins/WordNet/src/gate/wordnet/VerbImpl.java   2014-03-01 
10:23:29 UTC (rev 17494)
@@ -27,7 +27,7 @@
 public class VerbImpl extends WordSenseImpl
                       implements Verb {
 
-  private ArrayList verbFrames;
+  private List<VerbFrame> verbFrames;
 
   public VerbImpl(Word _word,
                   Synset _synset,
@@ -42,7 +42,7 @@
     Assert.assertNotNull(_jwVerb);
 
     String[] jwFrames = _jwVerb.getVerbFrames();
-    this.verbFrames = new ArrayList(jwFrames.length);
+    this.verbFrames = new ArrayList<VerbFrame>(jwFrames.length);
 
     for (int i= 0; i< jwFrames.length; i++) {
       this.verbFrames.add(new VerbFrameImpl(jwFrames[i]));
@@ -50,7 +50,7 @@
   }
 
   /** returns the verb frames associated with this synset */
-  public List getVerbFrames() {
+  public List<VerbFrame> getVerbFrames() {
     return this.verbFrames;
   }
 }
\ No newline at end of file

Modified: gate/trunk/plugins/WordNet/src/gate/wordnet/WordImpl.java
===================================================================
--- gate/trunk/plugins/WordNet/src/gate/wordnet/WordImpl.java   2014-03-01 
09:49:01 UTC (rev 17493)
+++ gate/trunk/plugins/WordNet/src/gate/wordnet/WordImpl.java   2014-03-01 
10:23:29 UTC (rev 17494)
@@ -16,7 +16,6 @@
 
 package gate.wordnet;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.Assert;
@@ -29,7 +28,7 @@
 
   private String lemma;
   private int senseCount;
-  private ArrayList wordSenses;
+  private List<WordSense> wordSenses;
   private Dictionary wnDictionary;
 
   public WordImpl(String _lemma, int _senseCount, Dictionary _wnDictionary) {
@@ -46,7 +45,7 @@
 
 
   /** returns the senses of this word */
-  public List getWordSenses() throws WordNetException{
+  public List<WordSense> getWordSenses() throws WordNetException{
 
     //do we have the list already?
     if (null == this.wordSenses) {
@@ -69,6 +68,8 @@
         net.didion.jwnl.data.Synset[] synsets = iWord.getSenses();
         for (int j=0; j< synsets.length; j++) {
           net.didion.jwnl.data.Synset currSynset = synsets[j];
+          
+          //TODO it seems that we need to actually finish this method
         }
       }
 

Modified: gate/trunk/plugins/WordNet/src/gate/wordnet/WordSenseImpl.java
===================================================================
--- gate/trunk/plugins/WordNet/src/gate/wordnet/WordSenseImpl.java      
2014-03-01 09:49:01 UTC (rev 17493)
+++ gate/trunk/plugins/WordNet/src/gate/wordnet/WordSenseImpl.java      
2014-03-01 10:23:29 UTC (rev 17494)
@@ -31,7 +31,7 @@
   private int senseNumber;
   private int orderInSynset;
   private boolean isSemcor;
-  private List lexRelations;
+  private List<LexicalRelation> lexRelations;
   private Dictionary wnDictionary;
 
   public WordSenseImpl(Word _word,
@@ -87,7 +87,7 @@
 
 
   /** return the Lex relations this sense participates in */
-  public List getLexicalRelations() throws WordNetException {
+  public List<LexicalRelation> getLexicalRelations() throws WordNetException {
 
     if (null == this.lexRelations) {
       _loadLexicalRelations();
@@ -98,15 +98,15 @@
 
 
   /** return the Lex relations (of the specified type) this sense participates 
in */
-  public List getLexicalRelations(int type) throws WordNetException {
+  public List<LexicalRelation> getLexicalRelations(int type) throws 
WordNetException {
 
-    List result = new ArrayList(1);
+    List<LexicalRelation> result = new ArrayList<LexicalRelation>(1);
 
     if (null == this.lexRelations) {
       _loadLexicalRelations();
     }
 
-    Iterator it = this.lexRelations.iterator();
+    Iterator<LexicalRelation> it = this.lexRelations.iterator();
     while (it.hasNext()) {
       LexicalRelation lRel = (LexicalRelation)it.next();
       Assert.assertNotNull(lRel);
@@ -139,7 +139,7 @@
         }
       }
 
-      this.lexRelations = new ArrayList(jwPointers.length);
+      this.lexRelations = new ArrayList<LexicalRelation>(jwPointers.length);
 
       for (int i= 0; i< jwPointers.length; i++) {
 

Modified: gate/trunk/src/main/gate/wordnet/WordNet.java
===================================================================
--- gate/trunk/src/main/gate/wordnet/WordNet.java       2014-03-01 09:49:01 UTC 
(rev 17493)
+++ gate/trunk/src/main/gate/wordnet/WordNet.java       2014-03-01 10:23:29 UTC 
(rev 17494)
@@ -45,10 +45,10 @@
   public Iterator<Synset> getUniqueBeginners();
 
   /** returns list of WordSense-s for specific lemma */
-  public List<Word> lookupWord(String lemma) throws WordNetException;
+  public List<WordSense> lookupWord(String lemma) throws WordNetException;
 
   /** returns list of WordSense-s for specific lemma of the specified POS */
-  public List<Word> lookupWord(String lemma, int pos) throws WordNetException;
+  public List<WordSense> lookupWord(String lemma, int pos) throws 
WordNetException;
 
   public void setPropertyUrl(URL _propertiesUrl);
   public URL getPropertyUrl();

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


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to