You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2009/07/17 14:25:58 UTC

svn commit: r795063 [1/2] - in /incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas: ./ impl/

Author: joern
Date: Fri Jul 17 12:25:57 2009
New Revision: 795063

URL: http://svn.apache.org/viewvc?rev=795063&view=rev
Log:
UIMA-1444 cas.impl package should use generics

Modified:
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationIndexImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConstraintFactoryImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/DebugFSLogicalStructure.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorAggregate.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorImplBase.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorWrapper.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSListIteratorImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/OutOfTypeSystemData.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/UnambiguousIteratorImpl.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASDeserializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XCASSerializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasDeserializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiCasSerializer.java
    incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/XmiSerializationSharedData.java

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java Fri Jul 17 12:25:57 2009
@@ -80,7 +80,7 @@
    * @exception NoSuchElementException
    *              If the iterator is not valid.
    */
-  FeatureStructure get() throws NoSuchElementException;
+  T get() throws NoSuchElementException;
 
   /**
    * Advance the iterator. This may invalidate the iterator.
@@ -113,7 +113,7 @@
    * @param fs
    *          The feature structure the iterator should be set to.
    */
-  void moveTo(FeatureStructure fs);
+  void moveTo(T fs);
 
   /**
    * Copy this iterator.

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationIndexImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationIndexImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationIndexImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationIndexImpl.java Fri Jul 17 12:25:57 2009
@@ -34,12 +34,12 @@
  */
 public class AnnotationIndexImpl implements AnnotationIndex {
 
-  private FSIndex index;
+  private FSIndex<AnnotationFS> index;
 
   /**
    * 
    */
-  public AnnotationIndexImpl(FSIndex index) {
+  public AnnotationIndexImpl(FSIndex<AnnotationFS> index) {
     super();
     this.index = index;
   }
@@ -122,11 +122,11 @@
    * 
    * @see org.apache.uima.cas.text.AnnotationIndex#iterator(boolean)
    */
-  public FSIterator iterator(boolean ambiguous) {
+  public FSIterator<AnnotationFS> iterator(boolean ambiguous) {
     if (ambiguous) {
       return this.index.iterator();
     }
-    return new Subiterator(this.index.iterator());
+    return new Subiterator<AnnotationFS>(this.index.iterator());
   }
 
   /*
@@ -134,7 +134,7 @@
    * 
    * @see org.apache.uima.cas.text.AnnotationIndex#subiterator(org.apache.uima.cas.text.AnnotationFS)
    */
-  public FSIterator subiterator(AnnotationFS annot) {
+  public FSIterator<AnnotationFS> subiterator(AnnotationFS annot) {
     return subiterator(annot, true, true);
   }
 
@@ -144,8 +144,8 @@
    * @see org.apache.uima.cas.text.AnnotationIndex#subiterator(org.apache.uima.cas.text.AnnotationFS,
    *      boolean, boolean)
    */
-  public FSIterator subiterator(AnnotationFS annot, boolean ambiguous, boolean strict) {
-    return new Subiterator(this.index.iterator(), annot, ambiguous, strict);
+  public FSIterator<AnnotationFS> subiterator(AnnotationFS annot, boolean ambiguous, boolean strict) {
+    return new Subiterator<AnnotationFS>(this.index.iterator(), annot, ambiguous, strict);
   }
 
   /*
@@ -162,7 +162,7 @@
     return tree;
   }
 
-  private void addChildren(AnnotationTreeNodeImpl node, FSIterator it) {
+  private void addChildren(AnnotationTreeNodeImpl node, FSIterator<AnnotationFS> it) {
     AnnotationTreeNodeImpl dtr;
     AnnotationFS annot;
     while (it.isValid()) {

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/AnnotationTreeNodeImpl.java Fri Jul 17 12:25:57 2009
@@ -30,14 +30,13 @@
  * 
  * 
  */
-
 public class AnnotationTreeNodeImpl implements AnnotationTreeNode {
 
   private AnnotationFS annot;
 
   private AnnotationTreeNodeImpl parent;
 
-  private ArrayList dtrs;
+  private ArrayList<AnnotationTreeNode> dtrs;
 
   private int pos;
 
@@ -46,7 +45,7 @@
    */
   AnnotationTreeNodeImpl() {
     super();
-    this.dtrs = new ArrayList();
+    this.dtrs = new ArrayList<AnnotationTreeNode>();
   }
 
   /*
@@ -117,7 +116,7 @@
    * 
    * @see org.apache.uima.cas.text.AnnotationTreeNode#getChildren()
    */
-  public ArrayList getChildren() {
+  public ArrayList<AnnotationTreeNode> getChildren() {
     return this.dtrs;
   }
 
@@ -142,5 +141,5 @@
     child.parent = this;
     this.dtrs.add(child);
   }
-
+  
 }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/BooleanConstraint.java Fri Jul 17 12:25:57 2009
@@ -34,7 +34,7 @@
 
   private final FSBooleanConstraint cons;
   
-  BooleanConstraint(ArrayList<?> path, FSBooleanConstraint constraint) {
+  BooleanConstraint(ArrayList<String> path, FSBooleanConstraint constraint) {
     super(path);
     this.cons = constraint;
   }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Fri Jul 17 12:25:57 2009
@@ -38,6 +38,8 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
 
 import org.apache.uima.cas.AbstractCas_ImplBase;
 import org.apache.uima.cas.AnnotationBaseFS;
@@ -155,16 +157,16 @@
     private LongHeap longHeap; // for storing 64 bit values
 
     // A map from Sofas to IndexRepositories.
-    private HashMap sofa2indexMap;
+    private Map<Integer, FSIndexRepository> sofa2indexMap;
 
     // A map from Sofa numbers to CAS views.
     // number 0 - not used
     // number 1 - used for view named "_InitialView"
     // number 2-n used for other views
-    private HashMap sofaNbr2ViewMap;
+    private Map<Integer, CAS> sofaNbr2ViewMap;
 
     // set of instantiated sofaNames
-    private HashSet sofaNameSet;
+    private Set<String> sofaNameSet;
 
     // Flag that initial Sofa has been created
     private boolean initialSofaCreated = false;
@@ -325,9 +327,9 @@
       commitTypeSystem();
     }
 
-    this.svd.sofa2indexMap = new HashMap();
-    this.svd.sofaNbr2ViewMap = new HashMap();
-    this.svd.sofaNameSet = new HashSet();
+    this.svd.sofa2indexMap = new HashMap<Integer, FSIndexRepository>();
+    this.svd.sofaNbr2ViewMap = new HashMap<Integer, CAS>();
+    this.svd.sofaNameSet = new HashSet<String>();
     this.svd.initialSofaCreated = false;
     this.svd.viewCount = 0;
     
@@ -634,7 +636,7 @@
   }
 
   private SofaFS getSofa(String sofaName) {
-    FSIterator iterator = this.svd.baseCAS.getSofaIterator();
+    FSIterator<SofaFS> iterator = this.svd.baseCAS.getSofaIterator();
     while (iterator.isValid()) {
       SofaFS sofa = (SofaFS) iterator.get();
       if (sofaName.equals(getStringValue(((FeatureStructureImpl) sofa).getAddress(),
@@ -661,8 +663,8 @@
     return this.svd.baseCAS;
   }
 
-  public FSIterator getSofaIterator() {
-    FSIndex sofaIndex = this.svd.baseCAS.indexRepository.getIndex(CAS.SOFA_INDEX_NAME);
+  public FSIterator<SofaFS> getSofaIterator() {
+    FSIndex<SofaFS> sofaIndex = this.svd.baseCAS.indexRepository.getIndex(CAS.SOFA_INDEX_NAME);
     return sofaIndex.iterator();
   }
 
@@ -776,8 +778,8 @@
     return null;
   }
 
-  public FSIterator createFilteredIterator(FSIterator it, FSMatchConstraint cons) {
-    return new FilteredIterator(it, cons);
+  public<T extends FeatureStructure> FSIterator<T> createFilteredIterator(FSIterator<T> it, FSMatchConstraint cons) {
+    return new FilteredIterator<T>(it, cons);
   }
 
   public void commitTypeSystem() {
@@ -982,8 +984,8 @@
   /**
    * @see org.apache.uima.cas.CAS#fs2listIterator(FSIterator)
    */
-  public ListIterator fs2listIterator(FSIterator it) {
-    return new FSListIteratorImpl(it);
+  public <T extends FeatureStructure> ListIterator<T> fs2listIterator(FSIterator<T> it) {
+    return new FSListIteratorImpl<T>(it);
   }
 
   /**
@@ -1504,7 +1506,7 @@
     }
     int loopStart = loopLen + 2;
 
-    FSIterator iterator = this.svd.baseCAS.getSofaIterator();
+    FSIterator<SofaFS> iterator = this.svd.baseCAS.getSofaIterator();
     final Feature idFeat = getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFAID);
     // Add FSs to index repository for each View
     while (iterator.isValid()) {
@@ -1551,7 +1553,7 @@
 	}
 	int loopStart = loopLen + 2;
 
-	FSIterator iterator = this.svd.baseCAS.getSofaIterator();
+	FSIterator<SofaFS> iterator = this.svd.baseCAS.getSofaIterator();
 	final Feature idFeat = getTypeSystem().getFeatureByFullName(CAS.FEATURE_FULL_NAME_SOFAID);
 	// Add FSs to index repository for each View
 	while (iterator.isValid()) {
@@ -1711,8 +1713,8 @@
     }
   }
 
-  static String mapName(String name, HashMap map) {
-    String out = (String) map.get(name);
+  static String mapName(String name, HashMap<String, String> map) {
+    String out = map.get(name);
     if (out != null) {
       return out;
     }
@@ -3917,8 +3919,8 @@
   private AnnotationFS createDocumentAnnotation(int length) {
     final TypeSystemImpl ts = this.svd.casMetadata.ts;
     // Remove any existing document annotations.
-    FSIterator it = getAnnotationIndex(ts.docType).iterator();
-    ArrayList list = new ArrayList();
+    FSIterator<AnnotationFS> it = getAnnotationIndex(ts.docType).iterator();
+    List<AnnotationFS> list = new ArrayList<AnnotationFS>();
     while (it.isValid()) {
       list.add(it.get());
       it.moveToNext();
@@ -3953,7 +3955,7 @@
       // base CAS has no document
       return null;
     }
-    FSIterator it = getAnnotationIndex(this.svd.casMetadata.ts.docType).iterator();
+    FSIterator<AnnotationFS> it = getAnnotationIndex(this.svd.casMetadata.ts.docType).iterator();
     if (it.isValid()) {
       return (AnnotationFS) it.get();
     }
@@ -4183,16 +4185,16 @@
    * 
    * @see org.apache.uima.cas.CAS#getViewIterator()
    */
-  public Iterator getViewIterator() {
-    List viewList = new ArrayList();
+  public Iterator<CAS> getViewIterator() {
+    List<CAS> viewList = new ArrayList<CAS>();
     // add initial view if it has no sofa
     if (!((CASImpl) getInitialView()).mySofaIsValid()) {
       viewList.add(getInitialView());
     }
     // add views with Sofas
-    FSIterator sofaIter = getSofaIterator();
+    FSIterator<SofaFS> sofaIter = getSofaIterator();
     while (sofaIter.hasNext()) {
-      viewList.add(getView((SofaFS) sofaIter.next()));
+      viewList.add(getView(sofaIter.next()));
     }
     return viewList.iterator();
   }
@@ -4202,7 +4204,7 @@
    * 
    * @see org.apache.uima.cas.CAS#getViewIterator(java.lang.String)
    */
-  public Iterator getViewIterator(String localViewNamePrefix) {
+  public Iterator<CAS> getViewIterator(String localViewNamePrefix) {
     // do sofa mapping for current component
     String absolutePrefix = null;
     if (getCurrentComponentInfo() != null) {
@@ -4213,8 +4215,8 @@
     }
 
     // find Sofas with this prefix
-    List viewList = new ArrayList();
-    FSIterator sofaIter = getSofaIterator();
+    List<CAS> viewList = new ArrayList<CAS>();
+    FSIterator<SofaFS> sofaIter = getSofaIterator();
     while (sofaIter.hasNext()) {
       SofaFS sofa = (SofaFS) sofaIter.next();
       String sofaId = sofa.getSofaID();

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMetadata.java Fri Jul 17 12:25:57 2009
@@ -119,12 +119,12 @@
   // how many offset values have already been used.
   private final void computeFeatureOffsets(Type t, int offset) {
     // Find all features for which the input type is the domain type.
-    List allFeats = t.getFeatures();
-    ArrayList introFeats = new ArrayList();
+    List<Feature> allFeats = t.getFeatures();
+    ArrayList<Feature> introFeats = new ArrayList<Feature>();
     final int numAllFeats = allFeats.size();
     Feature feat;
     for (int i = 0; i < numAllFeats; i++) {
-      feat = (Feature) allFeats.get(i);
+      feat = allFeats.get(i);
       if (feat.getDomain() == t) {
         introFeats.add(feat);
       }
@@ -140,10 +140,10 @@
     }
     // Call routine recursively for all subtypes. Increment input offset by
     // number of features introduced on this type.
-    Vector immediateSubtypes = ts.getDirectlySubsumedTypes(t);
+    Vector<Type> immediateSubtypes = ts.getDirectlySubsumedTypes(t);
     final int numTypes = immediateSubtypes.size();
     for (int i = 0; i < numTypes; i++) {
-      computeFeatureOffsets((Type) immediateSubtypes.get(i), offset + numFeats);
+      computeFeatureOffsets(immediateSubtypes.get(i), offset + numFeats);
     }
   }
 

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java Fri Jul 17 12:25:57 2009
@@ -22,8 +22,8 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 
 import org.apache.uima.cas.CAS;
@@ -39,8 +39,6 @@
  * Container for serialized CAS typing information. Contains information about the type system, as
  * well as the index repository. If more than one CAS that use the same type system and index
  * repository need to be serialized, this information needs to be serialized only once.
- * 
- * 
  */
 public class CASMgrSerializer implements Serializable {
 
@@ -196,9 +194,9 @@
     this.typeOrder = ir.getDefaultTypeOrder().getOrder();
     // Collect the index labels in a list, as we don't know how many there
     // are.
-    final ArrayList names = new ArrayList();
+    final List<String> names = new ArrayList<String>();
     // Create an iterator over the names.
-    final Iterator namesIt = ir.getLabels();
+    final Iterator<String> namesIt = ir.getLabels();
     // Add the names to the list, filtering out auto-indexes.
     while (namesIt.hasNext()) {
       String name = (String) namesIt.next();
@@ -220,7 +218,7 @@
     }
     // Create a vector of the indexes, and build the name-to-index map.
     this.nameToIndexMap = new int[numNames];
-    Vector indexVector = new Vector();
+    Vector<FSIndex> indexVector = new Vector<FSIndex>();
     FSIndex index;
     int pos;
     for (int i = 0; i < numNames; i++) {
@@ -244,7 +242,7 @@
     // Create the array with the indexing strategy.
     this.indexingStrategy = new int[numIndexes];
     for (int i = 0; i < numIndexes; i++) {
-      this.indexingStrategy[i] = ((FSIndex) indexVector.get(i)).getIndexingStrategy();
+      this.indexingStrategy[i] = indexVector.get(i).getIndexingStrategy();
     }
 
     // Create the array for the comparator index.
@@ -301,11 +299,11 @@
   }
 
   private void encodeStringSubtypes(TypeSystemImpl ts) {
-    Vector list = getStringSubtypes(ts);
+    Vector<Type> list = getStringSubtypes(ts);
     final int size = list.size();
     this.stringSubtypes = new int[size];
     this.stringSubtypeValuePos = new int[size];
-    ArrayList strVals = new ArrayList();
+    List<String> strVals = new ArrayList<String>();
     StringTypeImpl type;
     int pos = 0, typeCode;
     String[] stringSet;
@@ -326,7 +324,7 @@
     }
   }
 
-  private Vector getStringSubtypes(TypeSystemImpl ts) {
+  private Vector<Type> getStringSubtypes(TypeSystemImpl ts) {
     return ts.getDirectlySubsumedTypes(ts.getType(CAS.TYPE_NAME_STRING));
   }
 

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConstraintFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConstraintFactoryImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConstraintFactoryImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ConstraintFactoryImpl.java Fri Jul 17 12:25:57 2009
@@ -60,7 +60,7 @@
 
 	public FSMatchConstraint embedConstraint(FeaturePath featPath,
 			FSConstraint constraint) {
-		ArrayList path = new ArrayList();
+		ArrayList<String> path = new ArrayList<String>();
 		for (int i = 0; i < featPath.size(); i++) {
 			path.add(featPath.getFeature(i).getShortName());
 		}
@@ -79,7 +79,7 @@
 		}
 	}
 
-	public FSMatchConstraint embedConstraint(ArrayList path,
+	public FSMatchConstraint embedConstraint(ArrayList<String> path,
 			FSConstraint constraint) {
 		if (constraint instanceof FSMatchConstraint) {
 			return new EmbeddedConstraint(path, constraint);

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/DebugFSLogicalStructure.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/DebugFSLogicalStructure.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/DebugFSLogicalStructure.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/DebugFSLogicalStructure.java Fri Jul 17 12:25:57 2009
@@ -183,14 +183,14 @@
     public Object getSubTypes() {
       FSIndexRepository ir = cas.getIndexRepository();
       Type type = fsIndex.getType();
-      List subtypes = cas.getTypeSystem().getProperlySubsumedTypes(type);
+      List<Type> subtypes = cas.getTypeSystem().getProperlySubsumedTypes(type);
 
       DebugNameValuePair[] r = new DebugNameValuePair[subtypes.size()];
 
       int i = 0;
-      Iterator it = subtypes.iterator();
+      Iterator<Type> it = subtypes.iterator();
       while (it.hasNext()) {
-        Type stype = (Type) it.next();
+        Type stype = it.next();
         r[i++] = new DebugNameValuePair("Type: " + stype.getName(),
                 new UnexpandedFeatureStructures(ir.getIndex(indexName, stype)));
       }
@@ -240,7 +240,7 @@
     DebugNameValuePair[] result;
     String typeName = fsType.getName();
 
-    List features = fsType.getFeatures();
+    List<Feature> features = fsType.getFeatures();
     int nbrFeats = features.size();
     boolean isAnnotation = false;
     boolean isJCasClass = false;
@@ -275,11 +275,11 @@
   }
 
   private static void fillFeatures(DebugNameValuePair[] result, int startOffset,
-          FeatureStructure fs, List features) {
+          FeatureStructure fs, List<Feature> features) {
     int nbrFeats = features.size();
     int i = startOffset;
     for (int j = 0; j < nbrFeats; j++) {
-      Feature feat = (Feature) features.get(j);
+      Feature feat = features.get(j);
       DebugNameValuePair nv = new DebugNameValuePair(feat.getShortName(), null);
       String rangeTypeName = feat.getRange().getName();
       if ("uima.cas.Integer".equals(rangeTypeName))
@@ -404,25 +404,25 @@
   // }
 
   public static IndexInfo[] getIndexes(CAS cas) {
-    Iterator it = cas.getIndexRepository().getLabels();
-    ArrayList ll = new ArrayList();
+    Iterator<String> it = cas.getIndexRepository().getLabels();
+    List<IndexInfo> ll = new ArrayList<IndexInfo>();
     while (it.hasNext()) {
       ll.add(new IndexInfo(cas, (String) it.next()));
     }
-    return (IndexInfo[]) ll.toArray(new IndexInfo[ll.size()]);
+    return ll.toArray(new IndexInfo[ll.size()]);
 
   }
 
   public static ViewInfo[] getOtherViews(CAS cas) {
-    Iterator sofaIt = cas.getSofaIterator();
-    ArrayList r = new ArrayList();
+    Iterator<SofaFS> sofaIt = cas.getSofaIterator();
+    List<ViewInfo> r = new ArrayList<ViewInfo>();
     while (sofaIt.hasNext()) {
       SofaFS item = (SofaFS) sofaIt.next();
       CAS oCas = cas.getView(item);
       if (oCas != cas)
         r.add(new ViewInfo(oCas));
     }
-    return (ViewInfo[]) r.toArray(new ViewInfo[r.size()]);
+    return r.toArray(new ViewInfo[r.size()]);
   }
 
   // public static DebugNameValuePair [] getDebugLogicalStructure_JCas(JCas jcas) {
@@ -438,13 +438,13 @@
   }
 
   public static Object floatListToArray(FeatureStructure fs) {
-    List list = new ArrayList();
+    List<Float> list = new ArrayList<Float>();
 
     TypeSystem ts = fs.getCAS().getTypeSystem();
     Type emptyFSList = ts.getType("uima.cas.EmptyFloatList");
     Feature headFeature = ts.getFeatureByFullName("uima.cas.NonEmptyFloatList:head");
     Feature tailFeature = ts.getFeatureByFullName("uima.cas.NonEmptyFloatList:tail");
-    Set alreadySeen = new HashSet();
+    Set<FeatureStructure> alreadySeen = new HashSet<FeatureStructure>();
     FeatureStructure nextFs;
     for (FeatureStructure currentFs = fs; currentFs.getType() != emptyFSList; currentFs = nextFs) {
       list.add(Float.valueOf(currentFs.getFloatValue(headFeature)));
@@ -462,13 +462,13 @@
   }
 
   public static Object integerListToArray(FeatureStructure fs) {
-    List list = new ArrayList();
+    List<Integer> list = new ArrayList<Integer>();
     TypeSystem ts = fs.getCAS().getTypeSystem();
     Type emptyFSList = ts.getType("uima.cas.EmptyIntegerList");
     Feature headFeature = ts.getFeatureByFullName("uima.cas.NonEmptyIntegerList:head");
     Feature tailFeature = ts.getFeatureByFullName("uima.cas.NonEmptyIntegerList:tail");
 
-    Set alreadySeen = new HashSet();
+    Set<FeatureStructure> alreadySeen = new HashSet<FeatureStructure>();
     FeatureStructure nextFs;
     for (FeatureStructure currentFs = fs; currentFs.getType() != emptyFSList; currentFs = nextFs) {
       list.add(Integer.valueOf(currentFs.getIntValue(headFeature)));
@@ -486,13 +486,13 @@
   }
 
   public static Object stringListToArray(FeatureStructure fs) {
-    List list = new ArrayList();
+    List<String> list = new ArrayList<String>();
     TypeSystem ts = fs.getCAS().getTypeSystem();
     Type emptyFSList = ts.getType("uima.cas.EmptyStringList");
     Feature headFeature = ts.getFeatureByFullName("uima.cas.NonEmptyStringList:head");
     Feature tailFeature = ts.getFeatureByFullName("uima.cas.NonEmptyStringList:tail");
 
-    Set alreadySeen = new HashSet();
+    Set<FeatureStructure> alreadySeen = new HashSet<FeatureStructure>();
     FeatureStructure nextFs;
     for (FeatureStructure currentFs = fs; currentFs.getType() != emptyFSList; currentFs = nextFs) {
       list.add(currentFs.getStringValue(headFeature));
@@ -506,13 +506,13 @@
   }
 
   public static Object fsListToArray(FeatureStructure fs) {
-    List list = new ArrayList();
+    List<FeatureStructure> list = new ArrayList<FeatureStructure>();
     TypeSystem ts = fs.getCAS().getTypeSystem();
     Type emptyFSList = ts.getType("uima.cas.EmptyFSList");
     Feature headFeature = ts.getFeatureByFullName("uima.cas.NonEmptyFSList:head");
     Feature tailFeature = ts.getFeatureByFullName("uima.cas.NonEmptyFSList:tail");
 
-    Set alreadySeen = new HashSet();
+    Set<FeatureStructure> alreadySeen = new HashSet<FeatureStructure>();
     FeatureStructure nextFs;
     for (FeatureStructure currentFs = fs; currentFs.getType() != emptyFSList; currentFs = nextFs) {
       list.add(currentFs.getFeatureValue(headFeature));
@@ -525,7 +525,7 @@
     return list.toArray(new FeatureStructure[list.size()]);
   }
 
-  private static Object loopInList(List list) {
+  private static Object loopInList(List<?> list) {
     Object[] array = new Object[list.size() + 1];
     for (int i = 0; i < list.size(); i++) {
       Object v = list.get(i);

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/EmbeddedConstraint.java Fri Jul 17 12:25:57 2009
@@ -38,7 +38,7 @@
 
   private FSMatchConstraint cons;
 
-  EmbeddedConstraint(ArrayList path, FSConstraint cons) {
+  EmbeddedConstraint(ArrayList<String> path, FSConstraint cons) {
     super(path);
     this.cons = (FSMatchConstraint) cons;
   }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSClassRegistry.java Fri Jul 17 12:25:57 2009
@@ -145,7 +145,8 @@
    *   
    */
   // This map can be accessed on different threads at the same time
-  private final Map generatorsByClassLoader = Collections.synchronizedMap(new HashMap(4));
+  private final Map<ClassLoader, FSGenerator[]> generatorsByClassLoader = 
+          Collections.synchronizedMap(new HashMap<ClassLoader, FSGenerator[]>(4));
 
   // private final RedBlackTree rbt;
   // private final TreeMap map;
@@ -172,7 +173,7 @@
    *          the object having a createFS method in it for this type
    */
   void addClassForType(Type type, FSGenerator fsFactory) {
-    Iterator it = this.ts.getTypeIterator();
+    Iterator<Type> it = this.ts.getTypeIterator();
     TypeImpl sub;
     while (it.hasNext()) {
       sub = (TypeImpl) it.next();
@@ -213,7 +214,7 @@
     }
   }
   
-  public void saveGeneratorsForClassLoader(ClassLoader cl, FSGenerator [] newGenerators) {
+  public void saveGeneratorsForClassLoader(ClassLoader cl, FSGenerator[] newGenerators) {
     generatorsByClassLoader.put(cl, newGenerators);
   }
   

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSFloatConstraintImpl.java Fri Jul 17 12:25:57 2009
@@ -46,11 +46,11 @@
 
   private IntVector codes;
 
-  private Vector values;
+  private Vector<Float> values;
 
   FSFloatConstraintImpl() {
     this.codes = new IntVector();
-    this.values = new Vector();
+    this.values = new Vector<Float>();
   }
 
   public boolean match(float f) {
@@ -58,31 +58,31 @@
     for (int i = 0; i < max; i++) {
       switch (this.codes.get(i)) {
         case LT: {
-          if (f >= ((Float) this.values.get(i)).floatValue()) {
+          if (f >= (this.values.get(i)).floatValue()) {
             return false;
           }
           break;
         }
         case LEQ: {
-          if (f > ((Float) this.values.get(i)).floatValue()) {
+          if (f > (this.values.get(i)).floatValue()) {
             return false;
           }
           break;
         }
         case EQ: {
-          if (f != ((Float) this.values.get(i)).floatValue()) {
+          if (f != (this.values.get(i)).floatValue()) {
             return false;
           }
           break;
         }
         case GEQ: {
-          if (f < ((Float) this.values.get(i)).floatValue()) {
+          if (f < (this.values.get(i)).floatValue()) {
             return false;
           }
           break;
         }
         case GT: {
-          if (f <= ((Float) this.values.get(i)).floatValue()) {
+          if (f <= (this.values.get(i)).floatValue()) {
             return false;
           }
           break;

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java Fri Jul 17 12:25:57 2009
@@ -731,7 +731,7 @@
 
   }
 
-  private class IndexImpl implements FSIndex, FSIndexImpl {
+  private class IndexImpl<T extends FeatureStructure> implements FSIndex<T>, FSIndexImpl {
 
     private final IndexIteratorCachePair iicp;
 
@@ -788,7 +788,7 @@
     /**
      * @see org.apache.uima.cas.FSIndex#iterator()
      */
-    public FSIterator iterator() {
+    public FSIterator<T> iterator() {
       return new FSIteratorWrapper(createPointerIterator(this.iicp), FSIndexRepositoryImpl.this.cas);
     }
 

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorAggregate.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorAggregate.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorAggregate.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorAggregate.java Fri Jul 17 12:25:57 2009
@@ -34,12 +34,12 @@
  * 
  * <p>Note: this class does not support moveTo(FS), as it is not sorted.
  */
-class FSIteratorAggregate extends FSIteratorImplBase {
+class FSIteratorAggregate<T extends FeatureStructure> extends FSIteratorImplBase<T> {
   
   // Internal contract for this class is that isValid() iff the current iterator isValid().
 
   // A list of iterators, unordered.
-  private final List iterators;
+  private final List<FSIterator<T>> iterators;
   
   // The offset of the current index.
   private int iteratorIndex = 0;
@@ -48,37 +48,37 @@
    * The one and only constructor.
    * @param c Collection of input iterators.
    */
-  public FSIteratorAggregate(Collection c) {
+  public FSIteratorAggregate(Collection<FSIterator<T>> c) {
     super();
-    this.iterators = new ArrayList();
+    this.iterators = new ArrayList<FSIterator<T>>();
     this.iterators.addAll(c);
     // The unwritten contract of FSIterators is that they point to the first element when they are
     // constructed.  This is also one way of checking that the new iterator is valid (non-empty).
     moveToFirst();
   }
 
-  public FSIterator copy() {
-    ArrayList itCopies = new ArrayList(this.iterators.size());
+  public FSIterator<T> copy() {
+    ArrayList<FSIterator<T>> itCopies = new ArrayList<FSIterator<T>>(this.iterators.size());
     for (int i = 0; i < this.iterators.size(); i++) {
-      itCopies.add(((FSIterator) this.iterators.get(i)).copy());
+      itCopies.add(this.iterators.get(i).copy());
     }
-    FSIteratorAggregate copy = new FSIteratorAggregate(itCopies);
+    FSIteratorAggregate<T> copy = new FSIteratorAggregate<T>(itCopies);
     copy.iteratorIndex = this.iteratorIndex;
     return copy;
   }
 
-  public FeatureStructure get() throws NoSuchElementException {
+  public T get() throws NoSuchElementException {
     if (!isValid()) {
       throw new NoSuchElementException();
     }
-    return ((FSIterator) this.iterators.get(this.iteratorIndex)).get();
+    return this.iterators.get(this.iteratorIndex).get();
   }
 
   public boolean isValid() {
     return (this.iteratorIndex < this.iterators.size());
   }
 
-  public void moveTo(FeatureStructure fs) {
+  public void moveTo(T fs) {
     throw new UnsupportedOperationException("This operation is not supported on an aggregate iterator.");
   }
 
@@ -86,7 +86,7 @@
     // Go through the iterators, starting with the first one
     this.iteratorIndex = 0;
     while (this.iteratorIndex < this.iterators.size()) {
-      FSIterator it = (FSIterator) this.iterators.get(this.iteratorIndex);
+      FSIterator<T> it = this.iterators.get(this.iteratorIndex);
       // Reset iterator to first position
       it.moveToFirst();
       // If the iterator is valid (i.e., non-empty), return...
@@ -103,7 +103,7 @@
     // See comments on moveToFirst()
     this.iteratorIndex = this.iterators.size() - 1;
     while (this.iteratorIndex >= 0) {
-      FSIterator it = (FSIterator) this.iterators.get(this.iteratorIndex);
+      FSIterator<T> it = this.iterators.get(this.iteratorIndex);
       it.moveToLast();
       if (it.isValid()) {
         return;
@@ -118,7 +118,7 @@
       return;
     }
     // Grab current iterator and inc.
-    FSIterator current = (FSIterator) this.iterators.get(this.iteratorIndex);
+    FSIterator<T> current = this.iterators.get(this.iteratorIndex);
     current.moveToNext();
     // If we're ok with the current iterator, return.
     if (current.isValid()) {
@@ -126,7 +126,7 @@
     }
     ++this.iteratorIndex;
     while (this.iteratorIndex < this.iterators.size()) {
-      current = (FSIterator) this.iterators.get(this.iteratorIndex);
+      current = this.iterators.get(this.iteratorIndex);
       current.moveToFirst();
       if (current.isValid()) {
         return;
@@ -142,7 +142,7 @@
       return;
     }
     // Grab current iterator and dec.
-    FSIterator current = (FSIterator) this.iterators.get(this.iteratorIndex);
+    FSIterator<T> current = this.iterators.get(this.iteratorIndex);
     current.moveToPrevious();
     // If we're ok with the current iterator, return.
     if (current.isValid()) {
@@ -150,7 +150,7 @@
     }
     --this.iteratorIndex;
     while (this.iteratorIndex >= 0) {
-      current = (FSIterator) this.iterators.get(this.iteratorIndex);
+      current = this.iterators.get(this.iteratorIndex);
       current.moveToLast();
       if (current.isValid()) {
         return;

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorImplBase.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorImplBase.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorImplBase.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorImplBase.java Fri Jul 17 12:25:57 2009
@@ -23,19 +23,18 @@
 
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.cas.text.AnnotationIndex;
 
 /**
  * Base class for FSIterator implementations. Defines the hasNext, next, and remove methods required
  * by java.util.Iterator.
- * 
- * 
  */
-public abstract class FSIteratorImplBase implements FSIterator {
+public abstract class FSIteratorImplBase<T extends FeatureStructure> implements FSIterator<T> {
 
   // Jira UIMA-464: add annotation comparator to be able to use Collections.binarySearch() on
   // annotation list.
-  protected static class AnnotationComparator implements Comparator<FeatureStructure> {
+  protected static class AnnotationComparator<T extends AnnotationFS> implements Comparator<T> {
 
     private AnnotationIndex index;
 
@@ -44,7 +43,7 @@
       this.index = index;
     }
 
-    public int compare(FeatureStructure fs1, FeatureStructure fs2) {
+    public int compare(T fs1, T fs2) {
       return this.index.compare(fs1, fs2);
     }
 
@@ -64,8 +63,8 @@
    * 
    * @see java.util.Iterator#next()
    */
-  public FeatureStructure next() {
-    FeatureStructure result = get();
+  public T next() {
+    T result = get();
     moveToNext();
     return result;
   }
@@ -78,5 +77,4 @@
   public void remove() {
     throw new UnsupportedOperationException();
   }
-
 }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorWrapper.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorWrapper.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorWrapper.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIteratorWrapper.java Fri Jul 17 12:25:57 2009
@@ -23,12 +23,7 @@
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.internal.util.IntPointerIterator;
 
-/**
- * Class comment for FSIteratorWrapper.java goes here.
- * 
- * 
- */
-public class FSIteratorWrapper extends FSIteratorImplBase {
+public class FSIteratorWrapper<T extends FeatureStructure> extends FSIteratorImplBase<T> {
 
   IntPointerIterator it;
 
@@ -49,8 +44,8 @@
   /**
    * @see org.apache.uima.cas.FSIterator#get()
    */
-  public FeatureStructure get() {
-    return this.casImpl.createFS(this.it.get());
+  public T get() {
+    return (T) this.casImpl.createFS(this.it.get());
   }
 
   /**
@@ -84,8 +79,8 @@
   /**
    * @see org.apache.uima.cas.FSIterator#copy()
    */
-  public FSIterator copy() {
-    return new FSIteratorWrapper((IntPointerIterator) this.it.copy(), this.casImpl);
+  public FSIterator<T> copy() {
+    return new FSIteratorWrapper<T>((IntPointerIterator) this.it.copy(), this.casImpl);
   }
 
   /**

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSListIteratorImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSListIteratorImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSListIteratorImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSListIteratorImpl.java Fri Jul 17 12:25:57 2009
@@ -23,22 +23,23 @@
 import java.util.NoSuchElementException;
 
 import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.FeatureStructure;
 
 /**
  * Class comment for FSListIteratorImpl.java goes here.
  * 
  * 
  */
-class FSListIteratorImpl implements ListIterator {
+class FSListIteratorImpl<T extends FeatureStructure> implements ListIterator<T> {
 
   // Keep two pointers: one for the next element, and one for the previous
   // one. The two pointers are always moved in lockstep. Watch for border
   // conditions where only one of the pointers is valid.
-  private FSIterator forward;
+  private FSIterator<T> forward;
 
-  private FSIterator back;
+  private FSIterator<T> back;
 
-  public FSListIteratorImpl(FSIterator it) {
+  public FSListIteratorImpl(FSIterator<T> it) {
     super();
     this.forward = it;
     this.back = it.copy();
@@ -86,7 +87,7 @@
   /**
    * @see ListIterator#next()
    */
-  public Object next() throws NoSuchElementException {
+  public T next() throws NoSuchElementException {
     // Throw exception if forward pointer is invalid.
     if (!this.forward.isValid()) {
       throw new NoSuchElementException();
@@ -108,7 +109,7 @@
   /**
    * @see ListIterator#previous()
    */
-  public Object previous() throws NoSuchElementException {
+  public T previous() throws NoSuchElementException {
     // See comments for next().
     if (!this.back.isValid()) {
       throw new NoSuchElementException();
@@ -125,7 +126,7 @@
   /**
    * @see java.util.ListIterator#add(Object)
    */
-  public void add(Object o) {
+  public void add(T o) {
     throw new UnsupportedOperationException();
   }
 
@@ -151,9 +152,9 @@
   }
 
   /**
-   * @see java.util.ListIterator#set(Object)
+   * @see java.util.ListIterator#set(T)
    */
-  public void set(Object o) {
+  public void set(T o) {
     throw new UnsupportedOperationException();
   }
 

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImpl.java Fri Jul 17 12:25:57 2009
@@ -417,10 +417,6 @@
 			return WITH_LABEL;
 		}
 
-		int size() {
-			return this.count;
-		}
-
 	}
 
 	private final void getPrintRefs(PrintReferences printRefs) {
@@ -585,7 +581,7 @@
 
 		}
 
-		List feats = getType().getFeatures();
+		List<Feature> feats = getType().getFeatures();
 		Feature feat;
 		Type approp;
 		FeatureStructureImpl val;

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureValuePathImpl.java Fri Jul 17 12:25:57 2009
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 import org.apache.uima.cas.CAS;
@@ -108,9 +109,9 @@
 
 	private static final boolean CAS_TYPE_CHECKS = true;
 
-	private static final HashMap CONTAINER_TO_ELEMENTYPE_MAP;
+	private static final Map<String, String> CONTAINER_TO_ELEMENTYPE_MAP;
 
-	private static final HashMap LIST_TO_ARRAYTYPE_MAP;
+	private static final Map<String, String> LIST_TO_ARRAYTYPE_MAP;
 
 	private static final String COVERED_TEXT = "coveredText()";
 
@@ -149,7 +150,7 @@
 
 	static {
 		Arrays.sort(SIMPLE_VAL_TYPES);
-		CONTAINER_TO_ELEMENTYPE_MAP = new HashMap();
+		CONTAINER_TO_ELEMENTYPE_MAP = new HashMap<String, String>();
 		CONTAINER_TO_ELEMENTYPE_MAP.put(CAS.TYPE_NAME_INTEGER_ARRAY, CAS.TYPE_NAME_INTEGER);
 		CONTAINER_TO_ELEMENTYPE_MAP.put(CAS.TYPE_NAME_STRING_ARRAY, CAS.TYPE_NAME_STRING);
 		CONTAINER_TO_ELEMENTYPE_MAP.put(CAS.TYPE_NAME_FLOAT_ARRAY, CAS.TYPE_NAME_FLOAT);
@@ -157,7 +158,7 @@
 		CONTAINER_TO_ELEMENTYPE_MAP.put(CAS.TYPE_NAME_STRING_LIST, CAS.TYPE_NAME_STRING);
 		CONTAINER_TO_ELEMENTYPE_MAP.put(CAS.TYPE_NAME_FLOAT_LIST, CAS.TYPE_NAME_FLOAT);
 
-		LIST_TO_ARRAYTYPE_MAP = new HashMap();
+		LIST_TO_ARRAYTYPE_MAP = new HashMap<String, String>();
 		LIST_TO_ARRAYTYPE_MAP.put(CAS.TYPE_NAME_INTEGER_LIST, CAS.TYPE_NAME_INTEGER_ARRAY);
 		LIST_TO_ARRAYTYPE_MAP.put(CAS.TYPE_NAME_STRING_LIST, CAS.TYPE_NAME_STRING_ARRAY);
 		LIST_TO_ARRAYTYPE_MAP.put(CAS.TYPE_NAME_FLOAT_LIST, CAS.TYPE_NAME_FLOAT_ARRAY);

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FilteredIterator.java Fri Jul 17 12:25:57 2009
@@ -28,10 +28,10 @@
 /**
  * Implements a filtered iterator.
  */
-class FilteredIterator extends FSIteratorImplBase {
+class FilteredIterator<T extends FeatureStructure> extends FSIteratorImplBase<T> {
 
   // The base iterator.
-  private FSIterator it;
+  private FSIterator<T> it;
 
   // The filter constraint.
   private FSMatchConstraint cons;
@@ -44,7 +44,7 @@
   /**
    * Create a filtered iterator from a base iterator and a constraint.
    */
-  FilteredIterator(FSIterator it, FSMatchConstraint cons) {
+  FilteredIterator(FSIterator<T> it, FSMatchConstraint cons) {
     this();
     this.it = it;
     this.cons = cons;
@@ -88,7 +88,7 @@
     }
   }
 
-  public FeatureStructure get() throws NoSuchElementException {
+  public T get() throws NoSuchElementException {
     // This may throw an exception.
     return this.it.get();
   }
@@ -96,14 +96,14 @@
   /**
    * @see org.apache.uima.cas.FSIterator#copy()
    */
-  public FSIterator copy() {
-    return new FilteredIterator(this.it.copy(), this.cons);
+  public FSIterator<T> copy() {
+    return new FilteredIterator<T>(this.it.copy(), this.cons);
   }
 
   /**
    * @see org.apache.uima.cas.FSIterator#moveTo(FeatureStructure)
    */
-  public void moveTo(FeatureStructure fs) {
+  public void moveTo(T fs) {
     this.it.moveTo(fs);
     if (!this.cons.match(this.it.get())) {
       moveToNext();

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/FloatConstraint.java Fri Jul 17 12:25:57 2009
@@ -38,7 +38,7 @@
 
   private FSFloatConstraint floatConstraint;
 
-  FloatConstraint(ArrayList path, FSFloatConstraint cons) {
+  FloatConstraint(ArrayList<String> path, FSFloatConstraint cons) {
     super(path);
     this.floatConstraint = cons;
   }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/IntConstraint.java Fri Jul 17 12:25:57 2009
@@ -38,7 +38,7 @@
 
   private FSIntConstraint intConstraint;
 
-  IntConstraint(ArrayList path, FSIntConstraint cons) {
+  IntConstraint(ArrayList<String> path, FSIntConstraint cons) {
     super(path);
     this.intConstraint = cons;
   }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/ListUtils.java Fri Jul 17 12:25:57 2009
@@ -350,9 +350,9 @@
     return array;
   }
 
-  public int createIntList(List stringValues) {
+  public int createIntList(List<String> stringValues) {
     int first = cas.ll_createFS(eIntListType);
-    ListIterator iter = stringValues.listIterator(stringValues.size());
+    ListIterator<String> iter = stringValues.listIterator(stringValues.size());
     while (iter.hasPrevious()) {
       int value = Integer.parseInt((String) iter.previous());
       int node = cas.ll_createFS(neIntListType);
@@ -363,9 +363,9 @@
     return first;
   }
   
-  public int createFloatList(List stringValues) {
+  public int createFloatList(List<String> stringValues) {
     int first = cas.ll_createFS(eFloatListType);
-    ListIterator iter = stringValues.listIterator(stringValues.size());
+    ListIterator<String> iter = stringValues.listIterator(stringValues.size());
     while (iter.hasPrevious()) {
       float value = Float.parseFloat((String) iter.previous());
       int node = cas.ll_createFS(neFloatListType);
@@ -376,11 +376,11 @@
     return first;
   }
 
-  public int createStringList(List stringValues) {
+  public int createStringList(List<String> stringValues) {
     int first = cas.ll_createFS(eStringListType);
-    ListIterator iter = stringValues.listIterator(stringValues.size());
+    ListIterator<String> iter = stringValues.listIterator(stringValues.size());
     while (iter.hasPrevious()) {
-      String value = (String) iter.previous();
+      String value = iter.previous();
       int node = cas.ll_createFS(neStringListType);
       cas.setFeatureValue(node, stringHeadFeat, cas.addString(value));
       cas.setFeatureValue(node, stringTailFeat, first);
@@ -389,9 +389,9 @@
     return first;
   }
 
-  public int createFsList(List stringValues, IntVector fsAddresses) {
+  public int createFsList(List<String> stringValues, IntVector fsAddresses) {
     int first = cas.ll_createFS(eFsListType);
-    ListIterator iter = stringValues.listIterator(stringValues.size());
+    ListIterator<String> iter = stringValues.listIterator(stringValues.size());
     while (iter.hasPrevious()) {
       int value = Integer.parseInt((String) iter.previous());
       int node = cas.ll_createFS(neFsListType);
@@ -403,7 +403,7 @@
     return first;
   }
 
-  public int updateIntList(int addr, List stringValues) throws SAXException  {
+  public int updateIntList(int addr, List<String> stringValues) throws SAXException  {
     int first = addr;
     int currLength = this.getLength(this.neIntListType, addr);
     int curNode = addr;
@@ -421,7 +421,7 @@
   	  	           foundCycle = true;
   	  	           break;
   	  	}
-  	  	int value = Integer.parseInt((String) stringValues.get(i++));
+  	  	int value = Integer.parseInt(stringValues.get(i++));
   	    cas.setFeatureValue(curNode,floatHeadFeat, value);
   	    prevNode = curNode;
   	  	curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(intTailFeat));
@@ -479,7 +479,7 @@
     return first;
   }
 	  
-  public int updateFloatList(int addr, List stringValues) throws SAXException  {
+  public int updateFloatList(int addr, List<String> stringValues) throws SAXException  {
     int first = addr;
     int currLength = this.getLength(this.neFloatListType, addr);
     int curNode = addr;
@@ -496,7 +496,7 @@
 	  	           foundCycle = true;
 	  	           break;
 	  	}
-	  	float value = Float.parseFloat((String) stringValues.get(i++));
+	  	float value = Float.parseFloat(stringValues.get(i++));
 	    cas.setFeatureValue(curNode,floatHeadFeat, value);
 	    prevNode = curNode;
 	  	curNode = cas.getHeapValue(curNode + cas.getFeatureOffset(floatTailFeat));
@@ -555,7 +555,7 @@
     return first;
   }  
   
-  public int updateFsList(int addr, List stringValues, IntVector fsAddresses) throws SAXException  {
+  public int updateFsList(int addr, List<String> stringValues, IntVector fsAddresses) throws SAXException  {
     int first = addr;
     int currLength = this.getLength(this.neFsListType, addr);
     boolean foundCycle = false;
@@ -572,7 +572,7 @@
   	           foundCycle = true;
   	           break;
   	    }
-  	    int value = Integer.parseInt((String) stringValues.get(i++));
+  	    int value = Integer.parseInt(stringValues.get(i++));
         cas.setFeatureValue(curNode,fsHeadFeat, value);
         fsAddresses.add(curNode);
         prevNode = curNode;
@@ -634,7 +634,7 @@
     return first;
   }  
   
-  public int updateStringList(int addr, List stringValues) throws SAXException   {
+  public int updateStringList(int addr, List<String> stringValues) throws SAXException   {
     int first = addr;
     boolean foundCycle = false;
     IntRedBlackTree visited = new IntRedBlackTree();
@@ -651,7 +651,7 @@
 	    }
 	    String curValue = cas.getStringForCode(cas.getHeapValue(curNode
 	              + cas.getFeatureOffset(stringHeadFeat)));
-	    String newValue = (String)stringValues.get(i++);
+	    String newValue = stringValues.get(i++);
         if (!curValue.equals(newValue)) {		  
           cas.setFeatureValue(curNode, stringHeadFeat, cas.addString(newValue));
         }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/OutOfTypeSystemData.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/OutOfTypeSystemData.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/OutOfTypeSystemData.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/OutOfTypeSystemData.java Fri Jul 17 12:25:57 2009
@@ -37,25 +37,25 @@
   /**
    * List of FSData objects for out-of-typesystem FSs.
    */
-  List fsList = new ArrayList();
+  List<FSData> fsList = new ArrayList<FSData>();
 
   /**
    * Map from Integer (CAS address) to List of String arrays holding feature names and values for
    * out-of-typesystem features on in-typesystem FSs.
    */
-  Map extraFeatureValues = new HashMap();
+  Map<Integer, List<String[]>> extraFeatureValues = new HashMap<Integer, List<String[]>>();
 
   /**
    * Map from Integer (CAS address of an FSArray) to List of ArrayElement objects, each of which
    * holds an array index and value (as a string).
    */
-  Map arrayElements = new HashMap();
+  Map<Integer, List<ArrayElement>> arrayElements = new HashMap<Integer, List<ArrayElement>>();
 
   /**
    * Map used during re-serialization. Stores mapping from out-of-typesystem FS IDs to the actual
    * IDs used in the generated XCAS.
    */
-  Map idMap = new HashMap();
+  Map<String, String> idMap = new HashMap<String, String>();
 
   /**
    * For debugging purposes only.
@@ -63,21 +63,15 @@
   public String toString() {
     StringBuffer buf = new StringBuffer();
     buf.append("FeatureStructures\n-----------------\n");
-    Iterator it = fsList.iterator();
-    while (it.hasNext()) {
-      FSData fs = (FSData) it.next();
+    
+    for (FSData fs : fsList) {
       buf.append(fs.toString()).append("\n");
     }
     buf.append("\nFeatures\n-----------------\n");
-    it = extraFeatureValues.entrySet().iterator();
-    while (it.hasNext()) {
-      Map.Entry entry = (Map.Entry) it.next();
-      Integer id = (Integer) entry.getKey();
+    for (Map.Entry<Integer, List<String[]>> entry : extraFeatureValues.entrySet()) {
+      Integer id = entry.getKey();
       buf.append(id).append(": ");
-      List attrs = (List) entry.getValue();
-      Iterator it2 = attrs.iterator();
-      while (it2.hasNext()) {
-        String[] attr = (String[]) it2.next();
+      for (String[] attr : entry.getValue()) {
         buf.append(attr[0]).append("=").append(attr[1]).append('\n');
       }
     }
@@ -103,7 +97,7 @@
 
   String indexRep; // space-separated sequence of index repository numbers
 
-  Map featVals = new HashMap();
+  Map<String, String> featVals = new HashMap<String, String>();
 
   public String toString() {
     StringBuffer buf = new StringBuffer();

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/PathConstraint.java Fri Jul 17 12:25:57 2009
@@ -25,19 +25,16 @@
 
 /**
  * Implements a constraint embedded under a path. Optimize later.
- * 
- * 
- * @version $Revision: 1.2 $
  */
 abstract class PathConstraint implements FSMatchConstraint {
 
-  protected ArrayList featNames;
+  protected ArrayList<String> featNames;
 
   protected PathConstraint() {
     super();
   }
 
-  PathConstraint(ArrayList featNames) {
+  PathConstraint(ArrayList<String> featNames) {
     this();
     this.featNames = featNames;
   }
@@ -51,9 +48,8 @@
       if (i > 0) {
         buf.append('.');
       }
-      buf.append((String) this.featNames.get(i));
+      buf.append(this.featNames.get(i));
     }
     return buf.toString();
   }
-
 }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/StringConstraint.java Fri Jul 17 12:25:57 2009
@@ -38,7 +38,7 @@
 
   private FSStringConstraint stringConstraint;
 
-  StringConstraint(ArrayList path, FSStringConstraint cons) {
+  StringConstraint(ArrayList<String> path, FSStringConstraint cons) {
     super(path);
     this.stringConstraint = cons;
   }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java Fri Jul 17 12:25:57 2009
@@ -27,28 +27,24 @@
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.text.AnnotationFS;
-import org.apache.uima.cas.text.AnnotationIndex;
 
 /**
  * Subiterator implementation.
- * 
- * 
  */
+public class Subiterator<T extends AnnotationFS> extends FSIteratorImplBase<T> {
 
-public class Subiterator extends FSIteratorImplBase {
-
-  private ArrayList list;
+  private ArrayList<T> list;
 
   private int pos;
 
-  private Comparator annotationComparator = null;
+  private Comparator<T> annotationComparator = null;
 
   /**
    * 
    */
   private Subiterator() {
     super();
-    this.list = new ArrayList();
+    this.list = new ArrayList<T>();
     this.pos = 0;
   }
 
@@ -58,18 +54,18 @@
    * @param it
    *          The iterator to be disambiguated.
    */
-  Subiterator(FSIterator it) {
+  Subiterator(FSIterator<T> it) {
     this();
     it.moveToFirst();
     if (!it.isValid()) {
       return;
     }
-    AnnotationFS current, next;
-    current = (AnnotationFS) it.get();
+    T current, next;
+    current = it.get();
     this.list.add(current);
     it.moveToNext();
     while (it.isValid()) {
-      next = (AnnotationFS) it.get();
+      next = it.get();
       if (current.getEnd() <= next.getBegin()) {
         current = next;
         this.list.add(current);
@@ -78,7 +74,7 @@
     }
   }
 
-  Subiterator(FSIterator it, AnnotationFS annot, final boolean ambiguous, final boolean strict) {
+  Subiterator(FSIterator<T> it, T annot, final boolean ambiguous, final boolean strict) {
     this();
     if (ambiguous) {
       initAmbiguousSubiterator(it, annot, strict);
@@ -87,7 +83,7 @@
     }
   }
 
-  private void initAmbiguousSubiterator(FSIterator it, AnnotationFS annot, final boolean strict) {
+  private void initAmbiguousSubiterator(FSIterator<T> it, T annot, final boolean strict) {
     final int start = annot.getBegin();
     final int end = annot.getEnd();
     it.moveTo(annot);
@@ -98,9 +94,9 @@
     while (it.isValid() && ((AnnotationFS) it.get()).getBegin() < start) {
       it.moveToNext();
     }
-    AnnotationFS current;
+    T current;
     while (it.isValid()) {
-      current = (AnnotationFS) it.get();
+      current = it.get();
       // If the start of the current annotation is past the end parameter,
       // we're done.
       if (current.getBegin() > end) {
@@ -114,7 +110,7 @@
     }
   }
 
-  private void initUnambiguousSubiterator(FSIterator it, AnnotationFS annot, final boolean strict) {
+  private void initUnambiguousSubiterator(FSIterator<T> it, T annot, final boolean strict) {
     final int start = annot.getBegin();
     final int end = annot.getEnd();
     it.moveTo(annot);
@@ -124,23 +120,23 @@
     if (!it.isValid()) {
       return;
     }
-    annot = (AnnotationFS) it.get();
-    this.list = new ArrayList();
+    annot = it.get();
+    this.list = new ArrayList<T>();
     // Skip annotations with begin positions before the given start
     // position.
     while (it.isValid() && ((start > annot.getBegin()) || (strict && annot.getEnd() > end))) {
       it.moveToNext();
     }
     // Add annotations.
-    AnnotationFS current, next;
+    T current, next;
     if (!it.isValid()) {
       return;
     }
-    current = (AnnotationFS) it.get();
+    current = it.get();
     this.list.add(current);
     it.moveToNext();
     while (it.isValid()) {
-      next = (AnnotationFS) it.get();
+      next =  it.get();
       // If the next annotation overlaps, skip it.
       if (next.getBegin() < current.getEnd()) {
         it.moveToNext();
@@ -176,9 +172,9 @@
    * 
    * @see org.apache.uima.cas.FSIterator#get()
    */
-  public FeatureStructure get() throws NoSuchElementException {
+  public T get() throws NoSuchElementException {
     if (isValid()) {
-      return (FeatureStructure) this.list.get(this.pos);
+      return this.list.get(this.pos);
     }
     throw new NoSuchElementException();
   }
@@ -219,9 +215,9 @@
     this.pos = this.list.size() - 1;
   }
 
-  private final Comparator getAnnotationComparator(FeatureStructure fs) {
+  private final Comparator<T> getAnnotationComparator(FeatureStructure fs) {
     if (this.annotationComparator == null) {
-      this.annotationComparator = new AnnotationComparator(fs.getCAS().getAnnotationIndex());
+      this.annotationComparator = new AnnotationComparator<T>(fs.getCAS().getAnnotationIndex());
     }
     return this.annotationComparator;
   }
@@ -231,7 +227,7 @@
    * 
    * @see org.apache.uima.cas.FSIterator#moveTo(org.apache.uima.cas.FeatureStructure)
    */
-  public void moveTo(FeatureStructure fs) {
+  public void moveTo(T fs) {
     final int found = Collections.binarySearch(this.list, fs, getAnnotationComparator(fs));
     if (found >= 0) {
       this.pos = found;
@@ -245,8 +241,8 @@
    * 
    * @see org.apache.uima.cas.FSIterator#copy()
    */
-  public FSIterator copy() {
-    Subiterator copy = new Subiterator();
+  public FSIterator<T> copy() {
+    Subiterator<T> copy = new Subiterator<T>();
     copy.list = this.list;
     copy.pos = this.pos;
     return copy;

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl.java Fri Jul 17 12:25:57 2009
@@ -33,7 +33,7 @@
  * 
  * @version $Revision: 1.3 $
  */
-public class TypeImpl implements Type, Comparable {
+public class TypeImpl implements Type, Comparable<TypeImpl> {
 
   private final String name;
 
@@ -87,8 +87,9 @@
    * @deprecated
    */
   @Deprecated
-  public Vector getAppropriateFeatures() {
-    return new Vector(getFeatures());
+  public Vector<Feature> getAppropriateFeatures() {
+    return new Vector<Feature>(getFeatures());
+
   }
 
   /**
@@ -138,11 +139,11 @@
    * Note: you can only compare types from the same type system. If you compare types from different
    * type systems, the result is undefined.
    */
-  public int compareTo(Object o) {
-    if (this == o) {
+  public int compareTo(TypeImpl t) {
+    if (this == t) {
       return 0;
     }
-    TypeImpl t = (TypeImpl) o;
+
     return (this.code < t.code) ? -1 : 1;
   }
 
@@ -201,9 +202,9 @@
     return getFeatureByBaseName(featureName);
   }
 
-  public List getFeatures() {
+  public List<Feature> getFeatures() {
     int[] feats = this.ts.ll_getAppropriateFeatures(this.code);
-    ArrayList list = new ArrayList(feats.length);
+    List<Feature> list = new ArrayList<Feature>(feats.length);
     for (int i = 0; i < feats.length; i++) {
       list.add(this.ts.ll_getFeatureForCode(feats[i]));
     }

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java Fri Jul 17 12:25:57 2009
@@ -49,7 +49,7 @@
    * @param aTypeSystem
    *          the TypeSystem to convert
    * @param aOutputStream
-   *          the streamt o which XML output will be written
+   *          the stream to which XML output will be written
    * 
    * @throws IOException
    *           if there is a problem writing to the provided OutputStream
@@ -78,10 +78,10 @@
     ResourceSpecifierFactory factory = UIMAFramework.getResourceSpecifierFactory();
     TypeSystemDescription tsDesc = factory.createTypeSystemDescription();
 
-    List typeDescs = new ArrayList();
-    Iterator typeIterator = aTypeSystem.getTypeIterator();
+    List<TypeDescription> typeDescs = new ArrayList<TypeDescription>();
+    Iterator<Type> typeIterator = aTypeSystem.getTypeIterator();
     while (typeIterator.hasNext()) {
-      Type type = (Type) typeIterator.next();
+      Type type = typeIterator.next();
 
       Type superType = aTypeSystem.getParent(type);
       if ((type.getName().startsWith("uima.cas") && type.isFeatureFinal()) || type.isArray()) {
@@ -92,10 +92,10 @@
       typeDesc.setName(type.getName());
       typeDesc.setSupertypeName(superType.getName());
       LowLevelTypeSystem llts = aTypeSystem.getLowLevelTypeSystem();
-      List featDescs = new ArrayList();
-      Iterator featIterator = type.getFeatures().iterator();
+      List<FeatureDescription> featDescs = new ArrayList<FeatureDescription>();
+      Iterator<Feature> featIterator = type.getFeatures().iterator();
       while (featIterator.hasNext()) {
-        Feature feat = (Feature) featIterator.next();
+        Feature feat = featIterator.next();
         if (!feat.getDomain().equals(type)) {
           // Each feature only needs to be serialized once
           continue;

Modified: incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=795063&r1=795062&r2=795063&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Fri Jul 17 12:25:57 2009
@@ -25,6 +25,7 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Vector;
 
@@ -47,16 +48,15 @@
  */
 public class TypeSystemImpl implements TypeSystemMgr, LowLevelTypeSystem {
 
-  private static class ListIterator implements Iterator {
+  private static class ListIterator<T> implements Iterator<T> {
 
-    private final List list;
+    private final List<T> list;
 
     private final int len;
 
     private int pos = 0;
 
-    private ListIterator(List list, int max) {
-      super();
+    private ListIterator(List<T> list, int max) {
       this.list = list;
       this.len = (max < list.size()) ? max : list.size();
     }
@@ -65,11 +65,11 @@
       return this.pos < this.len;
     }
 
-    public Object next() {
+    public T next() {
       if (!hasNext()) {
         throw new NoSuchElementException();
       }
-      Object o = this.list.get(this.pos);
+      T o = this.list.get(this.pos);
       ++this.pos;
       return o;
     }
@@ -77,14 +77,13 @@
     public void remove() {
       throw new UnsupportedOperationException();
     }
-
   }
 
   // static maps ok for now - only built-in mappings stored here
   // which are the same for all type system instances
-  private static HashMap arrayComponentTypeNameMap = new HashMap();
+  private static Map<String, String> arrayComponentTypeNameMap = new HashMap<String, String>();
 
-  private static HashMap arrayTypeComponentNameMap = new HashMap();
+  private static Map<String, String> arrayTypeComponentNameMap = new HashMap<String, String>();
 
   private static final String arrayTypeSuffix = "[]";
 
@@ -130,16 +129,16 @@
   // feature is declared on).
   private StringToIntMap featureMap;
 
-  private ArrayList tree; // Collection of IntVectors encoding type tree
+  private List<IntVector> tree; // Collection of IntVectors encoding type tree
 
-  private ArrayList subsumes; // Collection of BitSets for subsumption relation
+  private List<BitSet> subsumes; // Collection of BitSets for subsumption relation
 
   private IntVector intro;
 
   // Indicates which type introduces a feature (domain)
   private IntVector featRange; // Indicates range type of features
 
-  private ArrayList approp; // For each type, an IntVector of appropriate
+  private ArrayList<IntVector> approp; // For each type, an IntVector of appropriate
 
   // features
 
@@ -147,16 +146,16 @@
   private int top;
 
   // An ArrayList (unsynchronized) of TypeImpl objects.
-  private ArrayList types;
+  private List<Type> types;
 
   // An ArrayList (unsynchronized) of FeatureImpl objects.
-  private ArrayList features;
+  private List<Feature> features;
 
   // List of parent types.
   private final IntVector parents;
 
   // String sets for string subtypes.
-  private final ArrayList stringSets;
+  private final List<String[]> stringSets;
 
   // This map contains an entry for every subtype of the string type. The value is a pointer into
   // the stringSets array list.
@@ -318,21 +317,21 @@
     this.featureMap = new StringToIntMap();
     // In each Vector, add null as first element, since we start
     // counting at 1.
-    this.tree = new ArrayList();
+    this.tree = new ArrayList<IntVector>();
     this.tree.add(null);
-    this.subsumes = new ArrayList();
+    this.subsumes = new ArrayList<BitSet>();
     this.subsumes.add(null);
     this.intro = new IntVector();
     this.intro.add(0);
     this.featRange = new IntVector();
     this.featRange.add(0);
-    this.approp = new ArrayList();
+    this.approp = new ArrayList<IntVector>();
     this.approp.add(null);
-    this.types = new ArrayList();
+    this.types = new ArrayList<Type>();
     this.types.add(null);
-    this.features = new ArrayList();
+    this.features = new ArrayList<Feature>();
     this.features.add(null);
-    this.stringSets = new ArrayList();
+    this.stringSets = new ArrayList<String[]>();
     this.stringSetMap = new IntRedBlackTree();
     this.componentToArrayTypeMap = new IntRedBlackTree();
     this.arrayToComponentTypeMap = new IntRedBlackTree();
@@ -444,13 +443,13 @@
     return getNumberOfTypes() + getSmallestType();
   }
 
-  public Vector getIntroFeatures(Type type) {
-    Vector feats = new Vector();
-    List appropFeats = type.getFeatures();
+  public Vector<Feature> getIntroFeatures(Type type) {
+    Vector<Feature> feats = new Vector<Feature>();
+    List<Feature> appropFeats = type.getFeatures();
     final int max = appropFeats.size();
     Feature feat;
     for (int i = 0; i < max; i++) {
-      feat = (Feature) appropFeats.get(i);
+      feat = appropFeats.get(i);
       if (feat.getDomain() == type) {
         feats.add(feat);
       }
@@ -507,7 +506,7 @@
     if (typeCode < LEAST_TYPE_CODE) {
       return null;
     }
-    return (Type) this.types.get(typeCode);
+    return this.types.get(typeCode);
   }
 
   /**
@@ -541,7 +540,7 @@
   }
 
   private static final String getArrayTypeName(String typeName) {
-    final String arrayTypeName = (String) arrayComponentTypeNameMap.get(typeName);
+    final String arrayTypeName = arrayComponentTypeNameMap.get(typeName);
     return (null == arrayTypeName) ? typeName + arrayTypeSuffix : arrayTypeName;
     // if (arrayComponentTypeNameMap.containsKey(typeName)) {
     // return (String) arrayComponentTypeNameMap.get(typeName);
@@ -560,7 +559,7 @@
   private static final String getBuiltinArrayComponent(String typeName) {
     // if typeName is not contained in the map, the "get" returns null
     // if (arrayTypeComponentNameMap.containsKey(typeName)) {
-    return (String) arrayTypeComponentNameMap.get(typeName);
+    return arrayTypeComponentNameMap.get(typeName);
     // }
     // return null;
   }
@@ -594,7 +593,7 @@
     if (typeCode < this.typeNameST.getStart()) {
       return null;
     }
-    return (Type) this.types.get(typeCode);
+    return this.types.get(typeCode);
   }
 
   /**
@@ -629,13 +628,13 @@
     // Create space for new type.
     newType();
     // Add an edge to the tree.
-    ((IntVector) this.tree.get(superType)).add(type);
+    (this.tree.get(superType)).add(type);
     // Update subsumption relation.
     updateSubsumption(type, superType);
     // Add inherited features.
-    final IntVector superApprop = (IntVector) this.approp.get(superType);
+    final IntVector superApprop = this.approp.get(superType);
     // superApprop.add(0);
-    final IntVector typeApprop = (IntVector) this.approp.get(type);
+    final IntVector typeApprop = this.approp.get(type);
     // typeApprop.add(0);
     final int max = superApprop.size();
     int featCode;
@@ -692,7 +691,7 @@
     if (featCode < this.featureNameST.getStart()) {
       return null;
     }
-    return (Feature) this.features.get(featCode);
+    return this.features.get(featCode);
   }
 
   /**
@@ -711,15 +710,15 @@
    * 
    * @return The iterator.
    */
-  public Iterator getTypeIterator() {
-    Iterator it = new ListIterator(this.types, this.numCommittedTypes);
+  public Iterator<Type> getTypeIterator() {
+    Iterator<Type> it = new ListIterator<Type>(this.types, this.numCommittedTypes);
     // The first element is null, so skip it.
     it.next();
     return it;
   }
 
-  public Iterator getFeatures() {
-    Iterator it = this.features.iterator();
+  public Iterator<Feature> getFeatures() {
+    Iterator<Feature> it = this.features.iterator();
     // The first element is null, so skip it.
     it.next();
     return it;
@@ -731,7 +730,7 @@
    * @return The top type.
    */
   public Type getTopType() {
-    return (Type) this.types.get(this.top);
+    return this.types.get(this.top);
   }
 
   /**
@@ -742,15 +741,16 @@
    *          Input type.
    * @return The list of types subsumed by <code>type</code>.
    */
-  public List getProperlySubsumedTypes(Type type) {
-    ArrayList subList = new ArrayList();
-    Iterator typeIt = getTypeIterator();
+  public List<Type> getProperlySubsumedTypes(Type type) {
+    List<Type> subList = new ArrayList<Type>();
+    Iterator<Type> typeIt = getTypeIterator();
     while (typeIt.hasNext()) {
-      Type t = (Type) typeIt.next();
+      Type t = typeIt.next();
       if (type != t && subsumes(type, t)) {
         subList.add(t);
       }
     }
+    
     return subList;
   }
 
@@ -761,16 +761,16 @@
    *          The input type.
    * @return A vector of the directly subsumed types.
    */
-  public Vector getDirectlySubsumedTypes(Type type) {
-    return new Vector(getDirectSubtypes(type));
+  public Vector<Type> getDirectlySubsumedTypes(Type type) {
+    return new Vector<Type>(getDirectSubtypes(type));
   }
 
-  public List getDirectSubtypes(Type type) {
+  public List<Type> getDirectSubtypes(Type type) {
     if (type.isArray()) {
-      return new ArrayList();
+      return new ArrayList<Type>();
     }
-    ArrayList list = new ArrayList();
-    IntVector sub = (IntVector) this.tree.get(((TypeImpl) type).getCode());
+    List<Type> list = new ArrayList<Type>();
+    IntVector sub = this.tree.get(((TypeImpl) type).getCode());
     final int max = sub.size();
     for (int i = 0; i < max; i++) {
       list.add(this.types.get(sub.get(i)));
@@ -779,7 +779,7 @@
   }
 
   public boolean directlySubsumes(int t1, int t2) {
-    IntVector sub = (IntVector) this.tree.get(t1);
+    IntVector sub = this.tree.get(t1);
     return sub.contains(t2);
   }
 
@@ -806,14 +806,14 @@
       return null;
     }
     // We have to copy the array since we don't have const.
-    return ((IntVector) this.approp.get(type)).toArrayCopy();
+    return (this.approp.get(type)).toArrayCopy();
   }
 
   /**
    * @return An offset <code>&gt;0</code> if <code>feat</code> exists; <code>0</code>, else.
    */
   int getFeatureOffset(int feat) {
-    return ((IntVector) this.approp.get(this.intro.get(feat))).position(feat) + 1;
+    return (this.approp.get(this.intro.get(feat))).position(feat) + 1;
   }
 
   /**
@@ -871,12 +871,12 @@
     // if (t == null) {
     // System.out.println("Type is null");
     // }
-    List typesLocal = getProperlySubsumedTypes(ll_getTypeForCode(domain));
+    List<Type> typesLocal = getProperlySubsumedTypes(ll_getTypeForCode(domain));
     typesLocal.add(ll_getTypeForCode(domain));
     // For each type, check that the feature doesn't already exist.
     int max = typesLocal.size();
     for (int i = 0; i < max; i++) {
-      String featureName = ((Type) typesLocal.get(i)).getName() + FEATURE_SEPARATOR + shortName;
+      String featureName = (typesLocal.get(i)).getName() + FEATURE_SEPARATOR + shortName;
       if (this.featureMap.containsKey(featureName)) {
         // We have already added this feature. If the range of the
         // duplicate
@@ -901,7 +901,7 @@
     int feat = this.featureNameST.set(name);
     // Add entries for all subtypes.
     for (int i = 0; i < max; i++) {
-      this.featureMap.put(((Type) typesLocal.get(i)).getName() + FEATURE_SEPARATOR + shortName,
+      this.featureMap.put((typesLocal.get(i)).getName() + FEATURE_SEPARATOR + shortName,
           feat);
     }
     this.intro.add(domain);
@@ -909,7 +909,7 @@
     max = this.typeNameST.size();
     for (int i = 1; i <= max; i++) {
       if (subsumes(domain, i)) {
-        ((IntVector) this.approp.get(i)).add(feat);
+        (this.approp.get(i)).add(feat);
       }
     }
     this.features.add(new FeatureImpl(feat, name, this, multiRefsAllowed));
@@ -924,7 +924,7 @@
     if (code < 1) {
       return null;
     }
-    return (Type) this.types.get(code);
+    return this.types.get(code);
   }
 
   private int addTopTypeInternal(String name) {
@@ -1006,7 +1006,7 @@
       // supertype must be top, or the abstract array base.
       return ((superType == this.top) || (superType == this.arrayBaseTypeCode));
     }
-    return ((BitSet) this.subsumes.get(superType)).get(type);
+    return this.subsumes.get(superType).get(type);
   }
 
   private void updateSubsumption(int type, int superType) {
@@ -1020,7 +1020,7 @@
   }
 
   private void addSubsubsumption(int superType, int type) {
-    ((BitSet) this.subsumes.get(superType)).set(type);
+    (this.subsumes.get(superType)).set(type);
   }
 
   private void newType() {
@@ -1151,7 +1151,7 @@
   // public for ref from JCas TOP type,
   // impl FeatureStructureImpl
   public String[] getStringSet(int i) {
-    return (String[]) this.stringSets.get(i);
+    return this.stringSets.get(i);
   }
 
   /*
@@ -1203,7 +1203,7 @@
 
   public Type ll_getTypeForCode(int typeCode) {
     if (isType(typeCode)) {
-      return (Type) this.types.get(typeCode);
+      return this.types.get(typeCode);
     }
     return null;
   }
@@ -1218,7 +1218,7 @@
 
   public Feature ll_getFeatureForCode(int featureCode) {
     if (isFeature(featureCode)) {
-      return (Feature) this.features.get(featureCode);
+      return this.features.get(featureCode);
     }
     return null;
   }
@@ -1263,7 +1263,7 @@
     if (arrayTypeCode == UNKNOWN_TYPE_CODE) {
       return null;
     }
-    return (Type) this.types.get(arrayTypeCode);
+    return this.types.get(arrayTypeCode);
   }
 
   public final int ll_getTypeClass(int typeCode) {
@@ -1362,7 +1362,7 @@
     // Add an edge to the tree.
     if (!isCommitted() && motherCode != fsArrayTypeCode ) {
       final int arrayBaseTypeCodeBeforeCommitted = this.arrayBaseTypeCode;
-      ((IntVector) this.tree.get(arrayBaseTypeCodeBeforeCommitted)).add(arrayTypeCode);
+      (this.tree.get(arrayBaseTypeCodeBeforeCommitted)).add(arrayTypeCode);
       // Update subsumption relation.
       updateSubsumption(arrayTypeCode, this.arrayBaseTypeCode);
     }
@@ -1400,7 +1400,7 @@
     if (!ll_isStringSubtype(typeCode)) {
       return null;
     }
-    return (String[]) this.stringSets.get(this.stringSetMap.get(typeCode));
+    return this.stringSets.get(this.stringSetMap.get(typeCode));
   }
 
 }