Revision: 16792
          http://sourceforge.net/p/gate/code/16792
Author:   markagreenwood
Date:     2013-08-15 18:40:45 +0000 (Thu, 15 Aug 2013)
Log Message:
-----------
lots of generics fixes

Modified Paths:
--------------
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteerXMLReader.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
    gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/LemmaImpl.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/MorphologyReader.java
    gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSMapper.java
    gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSTagger.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNest.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNestImpl.java
    
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixPool.java
    gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/TypePool.java

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
        2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteer.java
        2013-08-15 18:40:45 UTC (rev 16792)
@@ -44,7 +44,7 @@
     implements RussIEConstants {
 
   public InflectionalGazetteer() {
-    mapsList = new ArrayList(10);
+    mapsList = new ArrayList<Map>(10);
   }
 
   /** Debug flag
@@ -83,7 +83,7 @@
    *  each map's value might be an ArrayList of TYpe objects specifying 
categories
    *  tied to this word/phrase.
    */
-  protected ArrayList mapsList ;
+  protected List<Map> mapsList ;
 
   /** size of the mapsList
    */
@@ -91,7 +91,7 @@
 
   /** a list of distinct references to morpho syntactic set.
    */
-  protected Set msTypeSet = null;
+  protected Set<SuffixNest> msTypeSet = null;
 
   /**The path of the config file  */
   private URL config;
@@ -157,7 +157,7 @@
           mapsListSize = mapsList.size();
 
           //allocate the category Map with optimal initial capacity & load 
factor
-          msTypeSet = new HashSet();
+          msTypeSet = new HashSet<SuffixNest>();
 
           Lemma lemma;
           fireStatusChanged(READING + configLine);
@@ -261,7 +261,7 @@
     String phrase = "";
     int mapIndex = 0;
     FeatureMap fm;
-    HashMap currentMap = new HashMap();
+    Map currentMap = new HashMap();
     // whether the current word is the first in the phrase
     boolean firstWord = true;
     boolean punctuationZone = false;
@@ -442,17 +442,17 @@
           } // if mapindex out of bounds
 
           //try to find it in the dark cave ...
-          currentMap = (HashMap) mapsList.get(mapIndex);
+          currentMap = mapsList.get(mapIndex);
 
-          Map lemmaVsFm = this.lookup(phrase,currentMap);
+          Map<String, FeatureMap> lemmaVsFm = this.lookup(phrase,currentMap);
           if (lemmaVsFm != null && lemmaVsFm.size()>0) {
             matchedRegionEnd = iend;
             // generate lookups for the phrase so far
-            Iterator lemmaIter = lemmaVsFm.keySet().iterator();
+            Iterator<String> lemmaIter = lemmaVsFm.keySet().iterator();
             String lemma;
             while(lemmaIter.hasNext()) {
-              lemma = (String)lemmaIter.next();
-              fm = (FeatureMap) lemmaVsFm.get(lemma);
+              lemma = lemmaIter.next();
+              fm = lemmaVsFm.get(lemma);
               try {
                 annotationSet.add(new Long(matchedRegionStart),
                                   new Long(matchedRegionEnd),
@@ -518,7 +518,7 @@
   public Set lookup(String wordForm) {
     Set result  = null;
     for ( int li = 0 ; li < mapsListSize ; li++ ) {
-      HashMap list = (HashMap)mapsList.get(li);
+      Map list = mapsList.get(li);
       if (list.containsKey(wordForm)) {
         ArrayList lookupList = (ArrayList) list.get(wordForm);
         if (lookupList != null && lookupList.size()>0) {
@@ -533,7 +533,7 @@
   public boolean remove(String wordForm) {
     boolean isRemoved = false;
     for (int i = 0 ; i < mapsListSize ; i++) {
-      HashMap map = (HashMap)mapsList.get(i);
+      Map map = mapsList.get(i);
       if (map.containsKey(wordForm)) {
         map.remove(wordForm);
         isRemoved = true;
@@ -567,7 +567,7 @@
 //   } // avoid endless recursion
 
     //category key
-    Set key = new HashSet(1);
+    Set<SuffixNest> key = new HashSet<SuffixNest>(1);
 
     // add the lookup to the current key
     key.add(nest);
@@ -581,8 +581,8 @@
     String line = root;
     int mapIndex = -1;
     String word = null;
-    Set oldKey = null;
-    HashMap currentMap = null;
+    Set<SuffixNest> oldKey = null;
+    Map<String, Set> currentMap = null;
     int length = 0;
 
     mapIndex = -1;
@@ -610,7 +610,7 @@
       } // if the map doesn't exist
 
       // get the map and add the word to the map
-      currentMap = (HashMap)(mapsList.get(mapIndex));
+      currentMap = (mapsList.get(mapIndex));
       // try to get the current word
       // if there isn't such a word : add it with null key.
       if (!currentMap.containsKey(word)) {
@@ -629,19 +629,19 @@
         mapsList.add(new HashMap());
         mapsListSize++;
       } // if the map doesn't exist
-      currentMap = (HashMap)(mapsList.get(mapIndex));
+      currentMap = (mapsList.get(mapIndex));
     }
 
     try {
       //!!! put the category key in the last map
-      oldKey = (Set) currentMap.get(word);
+      oldKey = currentMap.get(word);
     } catch (Exception x) {
       x.printStackTrace();
       System.out.println("root = " +word);
     }
 
     if (null == oldKey) {
-      oldKey = new HashSet(1);
+      oldKey = new HashSet<SuffixNest>(1);
       oldKey.add(nest);
       currentMap.put(word,oldKey);
       isAdded = true;
@@ -711,7 +711,7 @@
    * @param map
    * @return the map of main form vs matching feature maps  for the current 
phrase and map
    */
-  private Map lookup(String phrase,Map map){
+  private Map<String, FeatureMap> lookup(String phrase,Map map){
     if (DETAILED_DEBUG) {
       System.out.println("phrase -> "+phrase);
     }
@@ -720,7 +720,7 @@
       phrase = phrase.toLowerCase();
     }
 
-    Map lemmaVsFm = new HashMap();
+    Map<String, FeatureMap> lemmaVsFm = new HashMap<String, FeatureMap>();
     Set nests;
     Iterator ni;
     String suffix = "";
@@ -739,7 +739,7 @@
             fm = nest.getFeatureMap();
             lemma = phrase+nest.getMainFormSuffix();
             fm.put(FEATURE_LEMMA,lemma);
-            oldFm = (FeatureMap)lemmaVsFm.get(lemma);
+            oldFm = lemmaVsFm.get(lemma);
             if ( oldFm != null ) {
               oldFm.putAll(fm);
             } else {

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteerXMLReader.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteerXMLReader.java
       2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/InflectionalGazetteerXMLReader.java
       2013-08-15 18:40:45 UTC (rev 16792)
@@ -33,9 +33,9 @@
     implements RussIEConstants, ContentHandler
 {
 
-    public InflectionalGazetteerXMLReader(ArrayList importTypes)
+    public InflectionalGazetteerXMLReader(List importTypes)
     {
-        lemmas = new ArrayList();
+        lemmas = new ArrayList<Lemma>();
         listImportTypes = new ArrayList();
         tagContent = new StringBuffer();
         parserValue = "org.apache.xerces.parsers.SAXParser";
@@ -45,7 +45,7 @@
 
     public static String getMajorType4Category(String cat)
     {
-        return (String)catVsMajorType.get(cat);
+        return catVsMajorType.get(cat);
     }
 
     public void load(String fileName)
@@ -147,7 +147,7 @@
         if(localName.equals("cat"))
             try
             {
-                String mtype = 
(String)catVsMajorType.get(tagContent.toString().trim());
+                String mtype = 
catVsMajorType.get(tagContent.toString().trim());
                 if(listImportTypes.contains(mtype))
                     lemma.getFeatureMap().put("majorType", mtype);
             }
@@ -203,14 +203,14 @@
     {
     }
 
-    public List getLemmas()
+    public List<Lemma> getLemmas()
     {
-        return new ArrayList(lemmas);
+        return new ArrayList<Lemma>(lemmas);
     }
 
-    private List lemmas;
+    private List<Lemma> lemmas;
     private String wordform;
-    protected ArrayList listImportTypes;
+    protected List listImportTypes;
     private StringBuffer tagContent;
     static final String DEFAULT_PARSER = "org.apache.xerces.parsers.SAXParser";
     public static final String TAG_RUSNAMES = "rusnames";
@@ -227,7 +227,7 @@
     public static final String CAT_PERSON_FAMILY = "PerFamily";
     public static final String CAT_PERSON_FIRST = "PerFirst";
     public static final String CAT_PERSON = "Per";
-    private static Map catVsMajorType;
+    private static Map<String, String> catVsMajorType;
     private String parserValue;
     Locator locator;
     Lemma lemma;
@@ -238,7 +238,7 @@
 
     static 
     {
-        catVsMajorType = new HashMap();
+        catVsMajorType = new HashMap<String, String>();
         catVsMajorType.put("Loc", "location");
         catVsMajorType.put("Per", "person_full");
         catVsMajorType.put("PerFamily", "surname");

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
        2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/gazetteer/RussGazetteer.java
        2013-08-15 18:40:45 UTC (rev 16792)
@@ -46,6 +46,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -109,7 +110,7 @@
   *  each map's value might be an ArrayList of Lookup objects specifying 
categories
   *  tied to this word/phrase.
   */
- protected ArrayList mapsList = new ArrayList(10);
+ protected List<Map> mapsList = new ArrayList<Map>(10);
 
  /** size of the mapsList
   */
@@ -117,7 +118,7 @@
 
  /** a list of references to Lookup objs representing the categories.
   */
- protected ArrayList categoryList = null;
+ protected ArrayList<Lookup> categoryList = null;
 
  /** Builds a gazetter using the default lists from the GATE resources
   * {see init()}
@@ -151,7 +152,7 @@
      mapsListSize = mapsList.size();
 
      //allocate the category Map with optimal initial capacity & load factor
-     categoryList = new ArrayList(linesCnt+1);
+     categoryList = new ArrayList<Lookup>(linesCnt+1);
 
      Iterator inodes = definition.iterator();
      LinearNode node;
@@ -271,8 +272,8 @@
    String phrase = EMPTY_STR;
    int mapIndex = 0;
    FeatureMap fm;
-   HashMap currentMap = new HashMap();
-   ArrayList currentLookup = null;
+   Map currentMap = new HashMap();
+   List currentLookup = null;
    // whether the current word is the first in the phrase
    boolean firstWord = true;
    boolean punctuationZone = false;
@@ -451,7 +452,7 @@
        } // if mapindex out of bounds
 
        //try to find it in the dark cave ...
-       currentMap = (HashMap) mapsList.get(mapIndex);
+       currentMap = mapsList.get(mapIndex);
        //if found in current map then set matchedRegion
        phrase = trunxSuffixVowelsFromPhrase(phrase);
        if (currentMap.containsKey(phrase)) {
@@ -534,7 +535,7 @@
  public Set lookup(String singleItem) {
    Set result  = null;
    for ( int li = 0 ; li < mapsListSize ; li++ ) {
-     HashMap list = (HashMap)mapsList.get(li);
+     Map list = mapsList.get(li);
      if (list.containsKey(singleItem)) {
        ArrayList lookupList = (ArrayList) list.get(singleItem);
        if (lookupList != null && lookupList.size()>0) {
@@ -549,7 +550,7 @@
  public boolean remove(String singleItem) {
    boolean isRemoved = false;
    for (int i = 0 ; i < mapsListSize ; i++) {
-     HashMap map = (HashMap)mapsList.get(i);
+     Map map = mapsList.get(i);
      if (map.containsKey(singleItem)) {
        map.remove(singleItem);
        isRemoved = true;
@@ -586,7 +587,7 @@
    }
 
    //category key
-   ArrayList key = new ArrayList(1);
+   ArrayList<Lookup> key = new ArrayList<Lookup>(1);
 
    // add the lookup to the current key
    key.add(lookup);
@@ -600,8 +601,8 @@
    String line = singleItem;
    int mapIndex = -1;
    String word = null;
-   ArrayList oldKey = null;
-   HashMap currentMap = new HashMap();
+   List<Lookup> oldKey = null;
+   Map<String, List<Lookup>> currentMap = new HashMap<String, List<Lookup>>();
    int length = 0;
 
    line = singleItem;
@@ -625,7 +626,7 @@
        } // if the map doesn't exist
 
        // get the map and add the word to the map
-       currentMap = (HashMap)(mapsList.get(mapIndex));
+       currentMap = (mapsList.get(mapIndex));
        // try to get the current word
        // if there isn't such a word : add it with null key.
        if (!currentMap.containsKey(word)) {
@@ -639,17 +640,17 @@
 
 
    //!!! put the category key in the last map
-   oldKey = (ArrayList) currentMap.get(word);
+   oldKey = currentMap.get(word);
    if (null == oldKey) {
      currentMap.put(word,key);
    } else {
      // merge the two arraylists
      // and check to avoid duplicity of lookups
      // note that key's length is 1
-     ArrayList mergedKey = new ArrayList(oldKey);
+     ArrayList<Lookup> mergedKey = new ArrayList<Lookup>(oldKey);
      boolean duplicity = false;
      for ( int i = 0; i < oldKey.size(); i++ ) {
-       duplicity = ((Lookup) mergedKey.get(i)).equals((Lookup)key.get(0));
+       duplicity = mergedKey.get(i).equals(key.get(0));
      } //for i
      if (!duplicity)
        mergedKey.add(key.get(0));

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/LemmaImpl.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/LemmaImpl.java    
    2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/LemmaImpl.java    
    2013-08-15 18:40:45 UTC (rev 16792)
@@ -41,13 +41,13 @@
   private String root;
 
   /** map of types vs word-form suffixes  */
-  private Map typeVsSuffix;
+  private Map<String, String> typeVsSuffix;
 
   /**the nest of suffixes */
   private SuffixNest suffixNest = new SuffixNestImpl();
 
   public LemmaImpl(){
-    typeVsSuffix = new HashMap();
+    typeVsSuffix = new HashMap<String, String>();
   }
 
   /**
@@ -85,8 +85,7 @@
    * @param wf word-form
    * @param type the type of the word-form*/
   public void addWordForm(String wf, String type) {
-    Set typeSet;
-
+    
     // fit the new wf to the root and retain wf suffix.
     String suffix = adjustRoot(wf);
 
@@ -115,7 +114,7 @@
    * @param type the word-form type
    * @return the suffix that has this type */
   public String getSuffix(String type) {
-    return (String)typeVsSuffix.get(type);
+    return typeVsSuffix.get(type);
   }
 
 
@@ -164,7 +163,7 @@
   /**
    * Fetch the set of word-form types in the lemma
    * @return the set of word-form types in the lemma */
-  public Set getTypes() {
+  public Set<String> getTypes() {
     return typeVsSuffix.keySet();
   }
 
@@ -176,12 +175,12 @@
   private void add2Suffixes(String prefix) {
     if (prefix == null || prefix.length()==0) return;
 
-    Iterator ki = typeVsSuffix.keySet().iterator();
+    Iterator<String> ki = typeVsSuffix.keySet().iterator();
     String type;
     String suffix;
     while(ki.hasNext()) {
-      type = (String)ki.next();
-      suffix = (String)typeVsSuffix.get(type);
+      type = ki.next();
+      suffix = typeVsSuffix.get(type);
       typeVsSuffix.put(type,prefix+suffix);
     } // while keys
 

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/MorphologyReader.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/MorphologyReader.java
 2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/MorphologyReader.java
 2013-08-15 18:40:45 UTC (rev 16792)
@@ -39,10 +39,10 @@
       +LINE_PREFIX+"] in the current morphology line.";
 
   /**the set of lemmas*/
-  private Set lemmas;
+  private Set<Lemma> lemmas;
 
   public MorphologyReader(boolean caseSensitive) {
-    lemmas = new HashSet();
+    lemmas = new HashSet<Lemma>();
   }
 
   /** Loads the morphology files */
@@ -71,7 +71,7 @@
 
   /**Gets the set of lemmas built from the morphology file.
    * @return the set of lemmas built from the morphology file. */
-  public Set getLemmas() {
+  public Set<Lemma> getLemmas() {
     return lemmas;
   }
 

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSMapper.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSMapper.java    
    2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSMapper.java    
    2013-08-15 18:40:45 UTC (rev 16792)
@@ -35,7 +35,6 @@
     public Resource init()
         throws ResourceInstantiationException
     {
-        gate.util.profile.Profiler profiler = null;
         fireStatusChanged("Init POS Mapper structures ...");
         initMap();
         fireProcessFinished();
@@ -44,7 +43,7 @@
 
     private void initMap()
     {
-        categoriesMap = new HashMap();
+        categoriesMap = new HashMap<String, String>();
         String adjTypes = 
"Au,Aupfpaa,Aupfpai,Aupfpd,Aupfpg,Aupfpi,Aupfpl,Aupfpn,Aupfsfa,Aupfsfd,Aupfsfg,Aupfsfi,Aupfsfl,Aupfsfn,Aupfsmaa,Aupfsmai,Aupfsmd,Aupfsmg,Aupfsmi,Aupfsml,Aupfsmn,Aupfsna,Aupfsnd,Aupfsng,Aupfsni,Aupfsnl,Aupfsnn,Aupsp,Aupssf,Aupssm,Aupssn";
         String type;
         for(StringTokenizer tok = new StringTokenizer(adjTypes, ","); 
tok.hasMoreElements(); categoriesMap.put(type, "JJ"))
@@ -82,7 +81,6 @@
     public void execute()
         throws ExecutionException
     {
-        gate.util.profile.Profiler profiler = null;
         if(super.document == null)
             throw new ExecutionException("No document to process!");
         AnnotationSet annotationSet;
@@ -118,7 +116,7 @@
             showMessage("No annotations from type Token");
             return;
         }
-        HashSet mappedTypes = new HashSet();
+        HashSet<String> mappedTypes = new HashSet<String>();
         Annotation list[] = msdSet.toArray(new Annotation[mappedTypes.size()]);
         Arrays.sort(list, new OffsetComparator());
         for(int index = 0; index < list.length;)
@@ -131,14 +129,14 @@
                 String msdType = (String)msdAnn.getFeatures().get("type");
                 if(msdType != null)
                 {
-                    tokType = (String)categoriesMap.get(msdType);
+                    tokType = categoriesMap.get(msdType);
                     if(tokType != null)
                         mappedTypes.add(tokType);
                 }
             } while(++index < list.length && msdAnn.compareTo(list[index]) == 
0);
             tokType = "";
-            for(Iterator it = mappedTypes.iterator(); it.hasNext();)
-                tokType = tokType + (String)it.next() + " ";
+            for(Iterator<String> it = mappedTypes.iterator(); it.hasNext();)
+                tokType = tokType + it.next() + " ";
 
             tokType = tokType.trim();
             AnnotationSet singleToken = 
tokenSet.getStrict(msdAnn.getStartNode().getOffset(), 
msdAnn.getEndNode().getOffset());
@@ -177,5 +175,5 @@
     protected static final boolean DEBUG = false;
     protected static final boolean DETAILED_DEBUG = false;
     protected String inputASName;
-    protected Map categoriesMap;
+    protected Map<String, String> categoriesMap;
 }

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSTagger.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSTagger.java    
    2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/POSTagger.java    
    2013-08-15 18:40:45 UTC (rev 16792)
@@ -42,6 +42,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -83,7 +84,7 @@
   *  each map's value might be an ArrayList of TYpe objects specifying 
categories
   *  tied to this word/phrase.
   */
- protected ArrayList mapsList ;
+ protected List<Map> mapsList ;
 
  /** size of the mapsList
   */
@@ -91,13 +92,13 @@
 
  /** a list of distinct references to morpho syntactic set.
   */
- protected Set msTypeSet = null;
+ protected Set<SuffixNest> msTypeSet = null;
 
  /**The location of the main configuration file  */
  private URL config;
 
  public POSTagger(){
-   mapsList = new ArrayList(10);
+   mapsList = new ArrayList<Map>(10);
  }
 
  /**
@@ -165,7 +166,7 @@
          //allocate the category Map with optimal initial capacity & load 
factor
          // IR - no idea what this is for, it gets overwritten every iteration
          // and is written to but not read within add()...
-         msTypeSet = new HashSet();
+         msTypeSet = new HashSet<SuffixNest>();
 
          Lemma lemma;
          fireStatusChanged(READING + configLine);
@@ -269,7 +270,7 @@
    String phrase = "";
    int mapIndex = 0;
    FeatureMap fm;
-   HashMap currentMap = new HashMap();
+   Map currentMap = new HashMap();
    // whether the current word is the first in the phrase
    boolean firstWord = true;
    boolean punctuationZone = false;
@@ -450,21 +451,21 @@
        } // if mapindex out of bounds
 
        //try to find it in the dark cave ...
-       currentMap = (HashMap) mapsList.get(mapIndex);
+       currentMap = mapsList.get(mapIndex);
 
-       Map lemmaVsTypes = this.lookup(phrase,currentMap);
+       Map<String, Set> lemmaVsTypes = this.lookup(phrase,currentMap);
        if (lemmaVsTypes != null && lemmaVsTypes.size()>0) {
          matchedRegionEnd = iend;
          // generate lookups for the phrase so far
          {
-           Iterator lemmaIter = lemmaVsTypes.keySet().iterator();
+           Iterator<String> lemmaIter = lemmaVsTypes.keySet().iterator();
            String lemma;
            Set typeSet;
            String type;
            Iterator typeIter;
            while(lemmaIter.hasNext()) {
-             lemma = (String)lemmaIter.next();
-             typeSet = (Set) lemmaVsTypes.get(lemma);
+             lemma = lemmaIter.next();
+             typeSet = lemmaVsTypes.get(lemma);
              typeIter = typeSet.iterator();
              while (typeIter.hasNext()){
                type = typeIter.next().toString();
@@ -539,7 +540,7 @@
  public Set lookup(String wordForm) {
    Set result  = null;
    for ( int li = 0 ; li < mapsListSize ; li++ ) {
-     HashMap list = (HashMap)mapsList.get(li);
+     Map list = mapsList.get(li);
      if (list.containsKey(wordForm)) {
        ArrayList lookupList = (ArrayList) list.get(wordForm);
        if (lookupList != null && lookupList.size()>0) {
@@ -554,7 +555,7 @@
  public boolean remove(String wordForm) {
    boolean isRemoved = false;
    for (int i = 0 ; i < mapsListSize ; i++) {
-     HashMap map = (HashMap)mapsList.get(i);
+     Map map = mapsList.get(i);
      if (map.containsKey(wordForm)) {
        map.remove(wordForm);
        isRemoved = true;
@@ -589,7 +590,7 @@
 //   } // avoid endless recursion
 
    //category key
-   Set key = new HashSet(1);
+   Set<SuffixNest> key = new HashSet<SuffixNest>(1);
 
    // add the lookup to the current key
    key.add(nest);
@@ -603,8 +604,8 @@
    String line = root;
    int mapIndex = -1;
    String word = null;
-   Set oldKey = null;
-   HashMap currentMap = null;
+   Set<SuffixNest> oldKey = null;
+   Map<String, Set> currentMap = null;
    int length = 0;
 
    mapIndex = -1;
@@ -631,7 +632,7 @@
        } // if the map doesn't exist
 
        // get the map and add the word to the map
-       currentMap = (HashMap)(mapsList.get(mapIndex));
+       currentMap = (mapsList.get(mapIndex));
        // try to get the current word
        // if there isn't such a word : add it with null key.
        if (!currentMap.containsKey(word)) {
@@ -650,19 +651,19 @@
        mapsList.add(new HashMap());
        mapsListSize++;
      } // if the map doesn't exist
-     currentMap = (HashMap)(mapsList.get(mapIndex));
+     currentMap = (mapsList.get(mapIndex));
    }
 
    try {
    //!!! put the category key in the last map
-     oldKey = (Set) currentMap.get(word);
+     oldKey = currentMap.get(word);
    } catch (Exception x) {
      x.printStackTrace();
      System.out.println("root = " +word);
    }
 
    if (null == oldKey) {
-     oldKey = new HashSet(1);
+     oldKey = new HashSet<SuffixNest>(1);
      oldKey.add(nest);
      currentMap.put(word,oldKey);
      isAdded = true;
@@ -722,7 +723,7 @@
   * @param map
   * @return the map of main form vs matching types for the current phrase and 
map
   */
- private Map lookup(String phrase,Map map){
+ private Map<String, Set> lookup(String phrase,Map map){
    if (DETAILED_DEBUG) {
      System.out.println("phrase -> "+phrase);
    }
@@ -731,7 +732,7 @@
      phrase = phrase.toLowerCase();
    }
 
-   Map lemmaVsTypes = new HashMap();
+   Map<String, Set> lemmaVsTypes = new HashMap<String, Set>();
    Set newTypes;
    Set nests;
    Iterator ni;
@@ -751,7 +752,7 @@
            newTypes = nest.getType(suffix);
            lemma = phrase+nest.getMainFormSuffix();
            if ( newTypes != null) {
-             types = (Set)lemmaVsTypes.get(lemma);
+             types = lemmaVsTypes.get(lemma);
              if (types == null) {
                lemmaVsTypes.put(lemma,newTypes);
              } else {

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNest.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNest.java   
    2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNest.java   
    2013-08-15 18:40:45 UTC (rev 16792)
@@ -36,13 +36,13 @@
    * @param suffix the suffix
    * @param typeSet the set of types
    */
-  void add(String suffix, Set typeSet) ;
+  void add(String suffix, Set<String> typeSet) ;
 
   /**
    * Get all suffixes in the nest.
    * @return the suffixes in the nest
    */
-  Set getSuffixes();
+  Set<String> getSuffixes();
 
   /**
    * Get all morpho-syntactic types.

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNestImpl.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNestImpl.java
   2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixNestImpl.java
   2013-08-15 18:40:45 UTC (rev 16792)
@@ -25,12 +25,12 @@
 public class SuffixNestImpl implements SuffixNest {
 
   /** map of word-form suffixes vs types */
-  private Map suffixVsType;
+  private Map<String, Object> suffixVsType;
   private String mainFormSuffix = "";
   private FeatureMap fm = Factory.newFeatureMap();
 
   public SuffixNestImpl() {
-    suffixVsType = new HashMap();
+    suffixVsType = new HashMap<String, Object>();
   }
 
   /**
@@ -63,7 +63,7 @@
         mainFormSuffix = suffix;
       }
     }
-    Set typeSet = new HashSet();
+    Set<String> typeSet = new HashSet<String>();
     typeSet.add(type);
     add ( suffix, typeSet);
   }
@@ -73,8 +73,8 @@
    * @param suffix the suffix
    * @param typeSet the set of types
    */
-  public void add(String suffix, Set typeSet)  {
-    Set set = (Set)suffixVsType.get(suffix);
+  public void add(String suffix, Set<String> typeSet)  {
+    Set<String> set = (Set<String>)suffixVsType.get(suffix);
     if (set != null) {
       typeSet.addAll(set);
     }
@@ -85,7 +85,7 @@
    * Get all suffixes in the nest.
    * @return the suffixes in the nest
    */
-  public Set getSuffixes() {
+  public Set<String> getSuffixes() {
     return suffixVsType.keySet();
   }
 
@@ -93,9 +93,9 @@
    * Get all morpho-syntactic types.
    * @return all morpho-syntactic types
    */
-  public Set getTypes() {
-    Iterator it = suffixVsType.values().iterator();
-    Set allTypes = new HashSet();
+  public Set<Object> getTypes() {
+    Iterator<Object> it = suffixVsType.values().iterator();
+    Set<Object> allTypes = new HashSet<Object>();
     Object o;
     while (it.hasNext()) {
       o = it.next();
@@ -115,8 +115,8 @@
    * @param suffix
    * @return the set of types associated with the suffix
    */
-  public Set getType(String suffix) {
-    return (Set)suffixVsType.get(suffix);
+  public Set<Object> getType(String suffix) {
+    return (Set<Object>)suffixVsType.get(suffix);
   }
 
   public int hashCode() {
@@ -139,12 +139,12 @@
    * @param prefix
    */
   public void addPrefix2Suffixes(String prefix) {
-    Iterator ki = suffixVsType.keySet().iterator();
+    Iterator<String> ki = suffixVsType.keySet().iterator();
     Object types;
     String suffix;
-    Map suffixVsTypeNew = new HashMap();
+    Map<String, Object> suffixVsTypeNew = new HashMap<String, Object>();
     while(ki.hasNext()) {
-      suffix = (String)ki.next();
+      suffix = ki.next();
       types = suffixVsType.get(suffix);
       suffixVsTypeNew.put(prefix+suffix,types);
     } // while keys
@@ -154,14 +154,14 @@
   public String toString(){
     StringBuffer result = new StringBuffer();
     result.append("\nSUFFIX NEST {");
-    ArrayList sufList = new ArrayList(getSuffixes());
+    ArrayList<String> sufList = new ArrayList<String>(getSuffixes());
 
     Collections.sort(sufList);
 
     String suffix;
     for ( int i = 0 ; i < sufList.size(); i++){
       if (i>0) result.append(",");
-      suffix = (String)sufList.get(i);
+      suffix = sufList.get(i);
       result.append(suffix).append(":");
       result.append(this.getType(suffix));
     }

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixPool.java
===================================================================
--- 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixPool.java   
    2013-08-15 18:17:31 UTC (rev 16791)
+++ 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/SuffixPool.java   
    2013-08-15 18:40:45 UTC (rev 16792)
@@ -16,7 +16,7 @@
  */
 public class SuffixPool {
 
-  private static Map pool = new HashMap();
+  private static Map<SuffixNest, SuffixNest> pool = new HashMap<SuffixNest, 
SuffixNest>();
 
   public SuffixPool() {
   }
@@ -35,7 +35,7 @@
 
     SuffixNest nest;
 
-    nest = (SuffixNest)pool.get(newNest);
+    nest = pool.get(newNest);
     return nest;
   } // getUniqueNestAs(newNest)
 

Modified: 
gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/TypePool.java
===================================================================
--- gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/TypePool.java 
2013-08-15 18:17:31 UTC (rev 16791)
+++ gate/trunk/plugins/Lang_Russian/src/com/ontotext/russie/morph/TypePool.java 
2013-08-15 18:40:45 UTC (rev 16792)
@@ -13,7 +13,7 @@
  */
 public class TypePool {
 
-  private static Map pool = new HashMap();
+  private static Map<String, String> pool = new HashMap<String, String>();
 
   public TypePool() {
   }
@@ -32,7 +32,7 @@
       return newType;
     }
 
-    return (String)pool.get(newType);
+    return pool.get(newType);
   } // getUniqueNestAs(newNest)
 
   public static String getString(){

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


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to