You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2015/11/09 20:36:36 UTC

svn commit: r1713518 - in /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas: ./ impl/

Author: schor
Date: Mon Nov  9 19:36:35 2015
New Revision: 1713518

URL: http://svn.apache.org/viewvc?rev=1713518&view=rev
Log:
[UIMA-4669] use TOP in preference to FeatureStructureImplC where it makes sense.  Use Annotation in preference to AnnotationFS, also. fix copy/paste error (copied ...setter... forgot to change to ...getter...) Also add some toString methods (e.g. to FsIterator_singletype) to aid in debugging

Modified:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_annotation.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_list.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_unordered.java

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/CAS.java Mon Nov  9 19:36:35 2015
@@ -29,6 +29,7 @@ import org.apache.uima.cas.text.Annotati
 import org.apache.uima.cas.text.AnnotationIndex;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.jcas.tcas.Annotation;
 
 /**
  * Object-oriented CAS (Common Analysis System) API.
@@ -760,7 +761,7 @@ public interface CAS extends AbstractCas
    * @return The document annotation, or <code>null</code> if there is none.  The return value is the
    *         JCas cover class or the plain Java cover class for FeatureStructures if JCas is not in use.
    */
-  <T extends AnnotationFS> T getDocumentAnnotation();
+  <T extends Annotation> T getDocumentAnnotation();
 
   /**
    * Informs the CAS of relevant information about the component that is currently processing it.

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Mon Nov  9 19:36:35 2015
@@ -355,9 +355,12 @@ public class CASImpl extends AbstractCas
     // unique ID for a created CAS view, not updated if CAS is reset and reused
     private final int casId = casIdProvider.incrementAndGet();
     
+//    private final BinaryCasSerDes bcsd;
+    
     private SharedViewData(CASImpl baseCAS, TypeSystemImpl tsi) {
       this.baseCAS = baseCAS;
       this.tsi = tsi;
+//      bcsd = new BinaryCasSerDes(this);
     }
   }
   
@@ -371,7 +374,7 @@ public class CASImpl extends AbstractCas
   // ----------------------------------------
   //   accessors for data in SharedViewData
   // ----------------------------------------
-  void addbackSingle(FeatureStructureImplC fs) {
+  void addbackSingle(TOP fs) {
     svd.fsTobeAddedbackSingle.addback(fs);
     svd.fsTobeAddedbackSingleInUse = false;
   }
@@ -623,11 +626,11 @@ public class CASImpl extends AbstractCas
     return createFSAnnotCheck(ti);
   }
   
-  
   private <T extends FeatureStructureImplC> T createFSAnnotCheck(TypeImpl ti) {
     if (ti.isAnnotationBaseType() && this.isBaseCas()) {    
         throw new CASRuntimeException(CASRuntimeException.DISALLOW_CREATE_ANNOTATION_IN_BASE_CAS, ti.getName());
     }
+
     T fs = (T) (((FsGenerator)getFsGenerator(ti.getCode())).createFS(ti, this));
     svd.cache_not_in_index = fs;
     return fs;
@@ -1086,7 +1089,11 @@ public class CASImpl extends AbstractCas
     }
     return null;
   }
-
+  
+  FSIndexRepositoryImpl getBaseIndexRepositoryImpl() {
+    return this.svd.baseCAS.indexRepository;
+  }
+  
   void addSofaFsToIndex(SofaFS sofa) {
     this.svd.baseCAS.getBaseIndexRepository().addFS(sofa);
   }
@@ -1217,7 +1224,7 @@ public class CASImpl extends AbstractCas
    * Only called from JCasGen'd code
    * 
    */
-  public void setWithCheckAndJournalJFRI(FeatureStructureImplC fs, int jcasFieldRegistryIndex, Runnable setter) {
+  public void setWithCheckAndJournalJFRI(TOP fs, int jcasFieldRegistryIndex, Runnable setter) {
     boolean wasRemoved = checkForInvalidFeatureSettingJFRI(fs, jcasFieldRegistryIndex);
     setter.run();
     if (wasRemoved) {
@@ -1226,7 +1233,7 @@ public class CASImpl extends AbstractCas
     maybeLogUpdateJFRI(fs, jcasFieldRegistryIndex);
   }
   
-  public void setWithCheckAndJournal(FeatureStructureImplC fs, int featCode, Runnable setter) {
+  public void setWithCheckAndJournal(TOP fs, int featCode, Runnable setter) {
     boolean wasRemoved = checkForInvalidFeatureSetting(fs, featCode);
     setter.run();
     if (wasRemoved) {
@@ -1327,7 +1334,8 @@ public class CASImpl extends AbstractCas
    * @param feat    the feature to set
    * @param value -
    */
-  public void setFeatureValue(FeatureStructureImplC fs, FeatureImpl feat, int v1, int v2) {
+  public void setFeatureValue(FeatureStructureImplC fsIn, FeatureImpl feat, int v1, int v2) {
+    TOP fs = (TOP) fsIn;
     boolean wasRemoved = checkForInvalidFeatureSetting(fs, feat.getCode());
     int offset = feat.getAdjustedOffset();
     fs._intData[offset] = v1;
@@ -1426,8 +1434,9 @@ public class CASImpl extends AbstractCas
   
   
   public String getFeatureValueAsString(FeatureStructureImplC fs, FeatureImpl feat) {
+    TypeImpl range = feat.getRangeImpl();
     if (feat.isInInt) {
-      switch (feat.getCode()) {
+      switch (range.getCode()) {
       case TypeSystemImpl.floatTypeCode :
         return Float.toString(fs.getFloatValue(feat));
       case TypeSystemImpl.booleanTypeCode :
@@ -1437,33 +1446,70 @@ public class CASImpl extends AbstractCas
       case TypeSystemImpl.doubleTypeCode :
         return Double.toString(fs.getDoubleValue(feat));
       default: 
-        return Double.toString(fs.getIntValue(feat));
+        return Integer.toString(fs.getIntValue(feat));
       }
     }
     
-    return fs.getFeatureValue(feat).toString();
+    if (range instanceof TypeImplString) {
+      return fs.getStringValue(feat);
+    }
+    
+    if (range.getCode() == TypeSystemImpl.javaObjectTypeCode) {
+      return serializeJavaObject(fs.getJavaObjectValue(feat));
+    }
+    
+    if (range.isRefType) {
+      return fs.getFeatureValue(feat).toString();
+    }
+    
+    throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
   }
 
   public void setFeatureValueFromString(FeatureStructureImplC fs, FeatureImpl feat, String s) {
-    if (feat.isInInt) {
+    final TypeImpl range = feat.getRangeImpl();
+    if (fs instanceof Sofa) {
+      // sofa has special setters
+      Sofa sofa = (Sofa) fs;
       switch (feat.getCode()) {
-      case TypeSystemImpl.floatTypeCode :
-        fs.setFloatValue(feat, Float.parseFloat(s));
-      case TypeSystemImpl.booleanTypeCode :
-        fs.setBooleanValue(feat, Boolean.parseBoolean(s));
-      case TypeSystemImpl.longTypeCode :
-        fs.setLongValue(feat,  Long.parseLong(s));
-      case TypeSystemImpl.doubleTypeCode :
-        fs.setDoubleValue(feat, Double.parseDouble(s));
-      default: 
-        fs.setIntValue(feat, Integer.parseInt(s));
+      case TypeSystemImpl.sofaMimeFeatCode : sofa.setMimeType(s); break;
+      case TypeSystemImpl.sofaStringFeatCode: sofa.setLocalSofaData(s); break;
+      case TypeSystemImpl.sofaUriFeatCode: sofa.setRemoteSofaURI(s); break;
+      default: // left empty - ignore trying to set final fields
       }
+      return;
+    }
+    
+    if (feat.isInInt) {
+      switch (range.getCode()) {
+      case TypeSystemImpl.floatTypeCode :   fs.setFloatValue(feat, Float.parseFloat(s)); break;
+      case TypeSystemImpl.booleanTypeCode : fs.setBooleanValue(feat, Boolean.parseBoolean(s)); break;
+      case TypeSystemImpl.longTypeCode :    fs.setLongValue(feat,  Long.parseLong(s)); break;
+      case TypeSystemImpl.doubleTypeCode :  fs.setDoubleValue(feat, Double.parseDouble(s)); break;
+      case TypeSystemImpl.byteTypeCode :  fs.setByteValue(feat, Byte.parseByte(s)); break;
+      case TypeSystemImpl.shortTypeCode :  fs.setShortValue(feat, Short.parseShort(s)); break;
+      case TypeSystemImpl.intTypeCode :  fs.setIntValue(feat, Integer.parseInt(s)); break;
+      default:                              fs.setIntValue(feat, Integer.parseInt(s));
+      }
+    } else if (range.isRefType) {
+      // Setting a reference value "{0}" from a string is not supported. 
+      throw new CASRuntimeException(CASRuntimeException.SET_REF_FROM_STRING_NOT_SUPPORTED, feat.getName());
+    } else if (range instanceof TypeImplString) {  // includes TypeImplSubString
+      // is String or Substring
+      fs.setStringValue(feat, s);
+    } else if (range == tsi.javaObjectType) {
+      fs.setJavaObjectValue(feat, deserializeJavaObject(s));
+    } else {
+      throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
     }
-    // Setting a reference value "{0}" from a string is not supported. 
-    throw new CASRuntimeException(CASRuntimeException.SET_REF_FROM_STRING_NOT_SUPPORTED, feat.getName());
   }
 
-   
+  private Object deserializeJavaObject(String s) {
+    throw new UnsupportedOperationException("Deserializing JavaObjects not yet implemented");
+  }
+
+  private String serializeJavaObject(Object s) {
+    throw new UnsupportedOperationException("Serializing JavaObjects not yet implemented");
+  }
 
   /*
    * This should be the only place where the encoding of floats and doubles in terms of ints is specified
@@ -1487,9 +1533,7 @@ public class CASImpl extends AbstractCas
 
   // Type access methods.
   public boolean isStringType(Type type) {
-    final TypeImpl ti = (TypeImpl) type;
-    final int typecode = ti.getCode();
-    return typecode == TypeSystemImpl.stringTypeCode || ti.isStringSubtype();
+    return type instanceof TypeImplString;
   }
 
   public boolean isArrayOfFsType(Type type) {
@@ -1814,11 +1858,11 @@ public class CASImpl extends AbstractCas
       // String id =
       // ll_getStringValue(((FeatureStructureImpl)aSofa).getAddress(),
       // ((FeatureImpl) idFeat).getCode());
-      if (this.svd.sofaNameSet.contains(id)) {
-        throw new CASRuntimeException(
-            CASRuntimeException.SOFANAME_ALREADY_EXISTS, id);
+      if (!this.svd.sofaNameSet.contains(id)) {
+        throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
+//            CASRuntimeException.SOFANAME_ALREADY_EXISTS, id);
       }
-      this.svd.sofaNameSet.add(id);
+//      this.svd.sofaNameSet.add(id);
     }
   }
 
@@ -2169,7 +2213,7 @@ public class CASImpl extends AbstractCas
    * @param featCode - the feature being tested
    * @return true if something may need to be added back
    */  
-  private boolean checkForInvalidFeatureSetting(FeatureStructureImplC fs, int featCode) {
+  private boolean checkForInvalidFeatureSetting(TOP fs, int featCode) {
     if (fs == svd.cache_not_in_index) {
       return false;
     }
@@ -2202,7 +2246,7 @@ public class CASImpl extends AbstractCas
   }
 
   // version of above, but using jcasFieldRegistryIndex
-  private boolean checkForInvalidFeatureSettingJFRI(FeatureStructureImplC fs, int jcasFieldRegistryIndex) {
+  private boolean checkForInvalidFeatureSettingJFRI(TOP fs, int jcasFieldRegistryIndex) {
     if (fs == svd.cache_not_in_index) {
       return false;
     }
@@ -2273,7 +2317,7 @@ public class CASImpl extends AbstractCas
    *   
    * @param fsRef the fs to add back
    */
-  public void maybeAddback(FeatureStructureImplC fs) {
+  public void maybeAddback(TOP fs) {
     if (!svd.fsTobeAddedbackSingleInUse && (!IS_DISABLED_PROTECT_INDEXES) && svd.fssTobeAddedback.size() == 0) {
       svd.fsTobeAddedbackSingle.addback(fs);
     }
@@ -2330,7 +2374,7 @@ public class CASImpl extends AbstractCas
    * @return true if the fs was removed
    */
   
-  boolean removeFromCorruptableIndexAnyView(final FeatureStructureImplC fs, FSsTobeAddedback toBeAdded, int featCode) {
+  boolean removeFromCorruptableIndexAnyView(final TOP fs, FSsTobeAddedback toBeAdded, int featCode) {
     if (fs != svd.cache_not_in_index && svd.featureCodesInIndexKeys.get(featCode)) {
       boolean wasRemoved = removeFromCorruptableIndexAnyView(fs, toBeAdded);
       svd.cache_not_in_index = fs; // because will remove it if its in the index.
@@ -2339,7 +2383,7 @@ public class CASImpl extends AbstractCas
     return false;
   }
     
-  boolean removeFromCorruptableIndexAnyView(final FeatureStructureImplC fs, FSsTobeAddedback toBeAdded) {
+  boolean removeFromCorruptableIndexAnyView(final TOP fs, FSsTobeAddedback toBeAdded) {
     final TypeImpl ti = ((FeatureStructureImplC)fs)._typeImpl;
     if (ti.isAnnotationBaseType()) {
       final AnnotationBase ab = (AnnotationBase) fs;
@@ -2375,7 +2419,7 @@ public class CASImpl extends AbstractCas
    * @param toBeAdded the place to record how many times it was in the index, per view
    * @return true if it was removed, false if it wasn't in any corruptable index.
    */
-  private boolean removeAndRecord(FeatureStructureImplC fs, FSIndexRepositoryImpl ir, FSsTobeAddedback toBeAdded) {
+  private boolean removeAndRecord(TOP fs, FSIndexRepositoryImpl ir, FSsTobeAddedback toBeAdded) {
     boolean wasRemoved = ir.removeIfInCorrputableIndexInThisView(fs);
     if (wasRemoved) {
       ((FSsTobeAddedback) toBeAdded).recordRemove(fs, ir, 1);
@@ -3062,14 +3106,15 @@ public class CASImpl extends AbstractCas
   }
 
   public AnnotationFS createAnnotation(Type type, int begin, int end) {
-    if (this.isBaseCas()) {
-      // Can't create annotation on base CAS
-      throw new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD, "createAnnotation(Type, int, int)");
-    }
+    // duplicates a later check
+//    if (this.isBaseCas()) {
+//      // Can't create annotation on base CAS
+//      throw new CASRuntimeException(CASRuntimeException.INVALID_BASE_CAS_METHOD, "createAnnotation(Type, int, int)");
+//    }
     Annotation fs = createFS(type);
     fs.setBegin(begin);
     fs.setEnd(end);
-    return (AnnotationFS) fs;
+    return fs;
   }
   
   public int ll_createAnnotation(int typeCode, int begin, int end) {
@@ -3082,15 +3127,20 @@ public class CASImpl extends AbstractCas
    * @param <T> the Java class associated with the annotation index
    * @return the annotation index
    */
+  @Override
   public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex() {
-    return indexRepository.getAnnotationIndex(getTypeSystemImpl().annotType);
+    return (AnnotationIndex<T>) indexRepository.getAnnotationIndex(getTypeSystemImpl().annotType);
   }
+  
+  
 
-  /**
-   * @see org.apache.uima.cas.CAS#getAnnotationIndex(Type)
+  /* (non-Javadoc)
+   * @see org.apache.uima.cas.CAS#getAnnotationIndex(org.apache.uima.cas.Type)
    */
-  public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex(Type type) {
-    return indexRepository.<T>getAnnotationIndex((TypeImpl) type);
+  @Override
+  public <T extends AnnotationFS> AnnotationIndex<T> getAnnotationIndex(Type type)
+      throws CASRuntimeException {
+    return (AnnotationIndex<T>) indexRepository.getAnnotationIndex((TypeImpl) type);
   }
 
   /**
@@ -3114,7 +3164,7 @@ public class CASImpl extends AbstractCas
     return getTypeSystemImpl().startFeat;
   }
 
-  private <T extends AnnotationFS> T createDocumentAnnotation(int length) {
+  private <T extends Annotation> T createDocumentAnnotation(int length) {
     final TypeSystemImpl ts = getTypeSystemImpl();
     // Remove any existing document annotations.
     FSIterator<T> it = this.<T>getAnnotationIndex(ts.docType).iterator();
@@ -3126,12 +3176,21 @@ public class CASImpl extends AbstractCas
     for (int i = 0; i < list.size(); i++) {
       getIndexRepository().removeFS(list.get(i));
     }
+    
     AnnotationFS docAnnot = createAnnotation(ts.docType, 0, length);
     docAnnot.setStringValue(ts.langFeat, CAS.DEFAULT_LANGUAGE_NAME);
     addFsToIndexes(docAnnot);
     return (T) docAnnot;
   }
   
+  private <T extends Annotation> T createDocumentAnnotationNoRemove(int length) {
+    final TypeSystemImpl ts = getTypeSystemImpl();
+    AnnotationFS docAnnot = createAnnotation(ts.docType, 0, length);
+    docAnnot.setStringValue(ts.langFeat, CAS.DEFAULT_LANGUAGE_NAME);
+    addFsToIndexes(docAnnot);
+    return (T) docAnnot;    
+  }
+  
   
   public int ll_createDocumentAnnotation(int length) {
     final int fsRef = ll_createDocumentAnnotationNoIndex(0, length);
@@ -3148,13 +3207,19 @@ public class CASImpl extends AbstractCas
 
   // For the "built-in" instance of Document Annotation, set the
   // "end" feature to be the length of the sofa string
-  public void updateDocumentAnnotation() {
+  /**
+   * updates the document annotation setting the end feature to be the length of the sofa string, if any.
+   * creates the document annotation if not present
+   * only works if not in the base cas
+   * @return the document annotation
+   */
+  public Annotation updateDocumentAnnotation() {
     if (!mySofaIsValid() || this == this.svd.baseCAS) {
-      return;
+      return null;
     }
     String newDoc = this.mySofaRef.getLocalStringData();
+    final Annotation docAnnot = getDocumentAnnotation();
     if (null != newDoc) {
-      final Annotation docAnnot = getDocumentAnnotation();
       if (docAnnot != null) {
         boolean wasRemoved = this.indexRepository.removeIfInCorrputableIndexInThisView(docAnnot);
         docAnnot.setIntValue(getTypeSystemImpl().endFeat, newDoc.length());
@@ -3163,9 +3228,10 @@ public class CASImpl extends AbstractCas
         }
       } else {
         // not in the index (yet)
-        createDocumentAnnotation(newDoc.length());
+        return createDocumentAnnotation(newDoc.length());
       }
     }
+    return docAnnot;
   }
   
   /**
@@ -3173,7 +3239,7 @@ public class CASImpl extends AbstractCas
    *   DocumentAnnotation or an instance of Annotation - the Java cover class used for 
    *   annotations when JCas is not being used.
    */
-  public <T extends AnnotationFS> T getDocumentAnnotation() {
+  public <T extends Annotation> T getDocumentAnnotation() {
     if (this == this.svd.baseCAS) {
       // base CAS has no document
       return null;
@@ -3182,7 +3248,7 @@ public class CASImpl extends AbstractCas
     if (it.isValid()) {
       return it.get();
     }
-    return createDocumentAnnotation(0);
+    return (T) createDocumentAnnotationNoRemove(0);
   }
   
   /**
@@ -3576,10 +3642,10 @@ public class CASImpl extends AbstractCas
   
   @Override
   public String toString() {
-    String sofa =  (mySofaRef == null) ? "_InitialView or no Sofa" :
+    String sofa =  (mySofaRef == null) ? (isBaseCas() ? "Base CAS" : "_InitialView or no Sofa") :
 //                 (mySofaRef == 0) ? "no Sofa" :
                    mySofaRef.getSofaID();
-    return this.getClass().getSimpleName() + " [view: " + sofa + "]";
+    return this.getClass().getSimpleName() + ":" + getCasId() + "[view: " + sofa + "]";
   }
     
   int getCasResets() {
@@ -3591,9 +3657,12 @@ public class CASImpl extends AbstractCas
   }
   
   public int setId2fs(FeatureStructureImplC fs) {
+    if (svd.id2fs.size() == 3761) {
+      System.out.println("debug");
+    }
     svd.id2fs.add(fs);
     if (svd.id2fs.size() != (2 + svd.fsIdGenerator.get())) {
-      System.out.println("debug");
+      System.out.println("debug out of sync id generator and id2fs size");
     }
     assert(svd.id2fs.size() == (2 + svd.fsIdGenerator.get()));
     return getNextFsId();

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASMgrSerializer.java Mon Nov  9 19:36:35 2015
@@ -261,7 +261,7 @@ public class CASMgrSerializer implements
       // array.
       this.comparatorIndex[i] = compPos;
       // Get the comparator.
-      comp = ((FSIndex_Impl) indexVector.get(i)).getComparatorForIndexSpecs();
+      comp = ((LowLevelIndex<FeatureStructure>) indexVector.get(i)).getComparatorForIndexSpecs();
       // Encode the type of the comparator.
       comps.add(((TypeImpl) comp.getType()).getCode());
       // How many keys in the comparator?

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java Mon Nov  9 19:36:35 2015
@@ -49,6 +49,7 @@ import org.apache.uima.internal.util.Int
 import org.apache.uima.internal.util.ObjHashSet;
 import org.apache.uima.jcas.cas.AnnotationBase;
 import org.apache.uima.jcas.cas.Sofa;
+import org.apache.uima.jcas.cas.TOP;
 import org.apache.uima.jcas.tcas.Annotation;
 import org.apache.uima.util.Misc;
 
@@ -205,16 +206,16 @@ public class FSIndexRepositoryImpl imple
      */
     int aSortedIndex = -1;   // -1 or the position of an arbitrary sorted index
     int aBagIndex = -1;      // -1 or the position of an arbitrary bag index
-    ArrayList<FsIndex_iicp<FeatureStructure>> indexesForType = new ArrayList<>(1); 
+    ArrayList<FsIndex_iicp<TOP>> indexesForType = new ArrayList<>(1); 
     
-    FsIndex_iicp<FeatureStructure> getNonSetIndex() {
+    FsIndex_iicp<TOP> getNonSetIndex() {
       if (aSortedIndex < 0 && aBagIndex < 0) { // index is empty!
         return null;
       }
       return indexesForType.get((aBagIndex >= 0) ? aBagIndex : aSortedIndex);
     }
     
-    void add(FsIndex_iicp<FeatureStructure> iicp) {
+    void add(FsIndex_iicp<TOP> iicp) {
       final int kind = iicp.fsIndex_singletype.getIndexingStrategy();
       int i = indexesForType.size();
       switch (kind) {
@@ -272,7 +273,7 @@ public class FSIndexRepositoryImpl imple
    * Different names may map to the same iicp.
    * The keys are the same across all views, but the values are different, per view
    */
-  final HashMap<String, FsIndex_iicp<FeatureStructure>> name2indexMap;
+  final HashMap<String, FsIndex_iicp<TOP>> name2indexMap;
  
   /**
    * speedup for annotation index accessing by type, lazily initialized
@@ -369,7 +370,7 @@ public class FSIndexRepositoryImpl imple
     final int numTypes = ts.getNumberOfTypes() + 1;
     this.detectIllegalIndexUpdates = new int[numTypes];
 //    this.flattenedIndexValid = new ConcurrentBits(numTypes);
-    this.name2indexMap = new HashMap<String, FsIndex_iicp<FeatureStructure>>();
+    this.name2indexMap = new HashMap<String, FsIndex_iicp<TOP>>();
     this.indexUpdates = new ArrayList<>();
     this.indexUpdateOperation = new BitSet();
     this.logProcessed = false;
@@ -397,7 +398,7 @@ public class FSIndexRepositoryImpl imple
     this.detectIllegalIndexUpdates = new int[numTypes];
 //    this.flattenedIndexValid = new ConcurrentBits(numTypes);
     
-    this.name2indexMap = new HashMap<String, FsIndex_iicp<FeatureStructure>>();
+    this.name2indexMap = new HashMap<String, FsIndex_iicp<TOP>>();
     this.indexUpdates = new ArrayList<>();
     this.indexUpdateOperation = new BitSet();
     this.logProcessed = false;
@@ -437,7 +438,7 @@ public class FSIndexRepositoryImpl imple
    
   <T extends FeatureStructure> 
       void createIndex(FSIndexRepositoryImpl baseIndexRepo, String key) {
-    final FsIndex_singletype<FeatureStructure> fsIndex = baseIndexRepo.name2indexMap.get(key).fsIndex_singletype;
+    final FsIndex_singletype<TOP> fsIndex = baseIndexRepo.name2indexMap.get(key).fsIndex_singletype;
     createIndexNoQuestionsAsked(fsIndex.getComparatorForIndexSpecs(), key, fsIndex.getIndexingStrategy());
   }
 
@@ -464,7 +465,7 @@ public class FSIndexRepositoryImpl imple
   public <T extends FeatureStructure> 
       boolean createIndexNoQuestionsAsked(final FSIndexComparator comp, String label, int indexType) {
     
-    FsIndex_iicp<FeatureStructure> cp = this.name2indexMap.get(label);
+    FsIndex_iicp<TOP> cp = this.name2indexMap.get(label);
    
 
     if (cp == null) {
@@ -575,21 +576,21 @@ public class FSIndexRepositoryImpl imple
    * Adding indexes to the index repository
    *******************************************/
   
-  private FsIndex_iicp<FeatureStructure> addNewIndex(FSIndexComparator comparator, int indexType) {
+  private FsIndex_iicp<TOP> addNewIndex(FSIndexComparator comparator, int indexType) {
     return addNewIndex(comparator, DEFAULT_INDEX_SIZE, indexType);
   }
 
   /**
    * This is where the actual index gets created.
    */
-  private <T extends FeatureStructure> FsIndex_iicp<T> addNewIndex(final FSIndexComparator comparator, int initialSize, int indexType) {
+  private <T extends TOP> FsIndex_iicp<T> addNewIndex(final FSIndexComparator comparator, int initialSize, int indexType) {
     FsIndex_iicp<T> iicp = null;
     if (isAnnotationIndex(comparator, indexType)) {
       FsIndex_singletype<Annotation> index = addNewIndexCore(comparator, initialSize, indexType);
       iicp = (FsIndex_iicp<T>) new FsIndex_annotation<Annotation>(index); 
     } else {
-      FsIndex_singletype<FeatureStructure> index = addNewIndexCore(comparator, initialSize, indexType);
-      iicp = (FsIndex_iicp<T>) new FsIndex_iicp<FeatureStructure>(index); 
+      FsIndex_singletype<TOP> index = addNewIndexCore(comparator, initialSize, indexType);
+      iicp = (FsIndex_iicp<T>) new FsIndex_iicp<TOP>(index); 
     }
     final Type type = comparator.getType();
     final int typeCode = ((TypeImpl) type).getCode();
@@ -598,7 +599,7 @@ public class FSIndexRepositoryImpl imple
 //    if (indexType == FSIndex.SORTED_INDEX) {
 //      this.indexArray[typeCode].add(0, iicp);  // shifts rest down
 //    } else 
-    this.indexArray[typeCode].add((FsIndex_iicp<FeatureStructure>) iicp);
+    this.indexArray[typeCode].add((FsIndex_iicp<TOP>) iicp);
 //    }
     return iicp;
   }
@@ -626,7 +627,7 @@ public class FSIndexRepositoryImpl imple
    * @param indexType -
    * @return -
    */
-  <T extends FeatureStructure> FsIndex_singletype<T> addNewIndexCore(
+  <T extends TOP> FsIndex_singletype<T> addNewIndexCore(
       final FSIndexComparator comparatorForIndexSpecs, 
       int initialSize,
       int indexType) {
@@ -679,7 +680,7 @@ public class FSIndexRepositoryImpl imple
    * @param indexType
    * @return the iicp for the top new index
    */
-  private FsIndex_iicp<FeatureStructure> addNewIndexRecursive(FSIndexComparator compForIndexSpecs, int indexType) {
+  private FsIndex_iicp<TOP> addNewIndexRecursive(FSIndexComparator compForIndexSpecs, int indexType) {
     final FSIndexComparatorImpl compCopy = ((FSIndexComparatorImpl)compForIndexSpecs).copy();
     return addNewIndexRec(compCopy, indexType);
   }
@@ -694,8 +695,8 @@ public class FSIndexRepositoryImpl imple
    * @param indexType
    * @return the new iicp for the new index
    */
-  private FsIndex_iicp<FeatureStructure> addNewIndexRec(FSIndexComparator comp4indexSpecs, int indexType) {
-    final FsIndex_iicp<FeatureStructure> iicp = this.addNewIndex(comp4indexSpecs, indexType);
+  private FsIndex_iicp<TOP> addNewIndexRec(FSIndexComparator comp4indexSpecs, int indexType) {
+    final FsIndex_iicp<TOP> iicp = this.addNewIndex(comp4indexSpecs, indexType);
     
     /**
      * Maybe add this index for all subtypes (exception: default bag index)
@@ -726,14 +727,14 @@ public class FSIndexRepositoryImpl imple
    * @return the index in the set of iicps for this type for the matching index
    */
   private static final int findIndex(
-      ArrayList<FsIndex_iicp<FeatureStructure>> indexes,
+      ArrayList<FsIndex_iicp<TOP>> indexes,
       FSIndexComparator comp,
       int indexingStrategy) {
     
     int i = 0;
     
-    for (FsIndex_iicp<FeatureStructure> iicp : indexes) {
-      final FsIndex_singletype<FeatureStructure> iicpIndex = iicp.fsIndex_singletype;
+    for (FsIndex_iicp<TOP> iicp : indexes) {
+      final FsIndex_singletype<TOP> iicpIndex = iicp.fsIndex_singletype;
       if (iicpIndex.getIndexingStrategy() == indexingStrategy &&
           iicpIndex.getComparatorForIndexSpecs().equals(comp)) {
         return i;
@@ -881,7 +882,7 @@ public class FSIndexRepositoryImpl imple
   public <T extends FeatureStructure> FSIndex<T> getIndex(String label, Type type) {
     
     // iicp is for the type the index was defined for
-    final FsIndex_iicp<FeatureStructure> iicp = (FsIndex_iicp<FeatureStructure>) this.name2indexMap.get(label);
+    final FsIndex_iicp<TOP> iicp = this.name2indexMap.get(label);
     if (iicp == null) {
       return null;
     }
@@ -900,7 +901,7 @@ public class FSIndexRepositoryImpl imple
       throw new CASRuntimeException(CASRuntimeException.TYPE_NOT_IN_INDEX, label, type.getName(), indexType.getName());
     }
 
-    final ArrayList<FsIndex_iicp<FeatureStructure>> inds = this.getIndexesForType(((TypeImpl) type).getCode()).indexesForType;
+    final ArrayList<FsIndex_iicp<TOP>> inds = this.getIndexesForType(((TypeImpl) type).getCode()).indexesForType;
     // Since we found an index for the correct type, and 
     // named indexes at creation time create all their subtype iicps, find() must return a
     // valid result
@@ -926,7 +927,7 @@ public class FSIndexRepositoryImpl imple
     incrementIllegalIndexUpdateDetector(typeCode);
     // get a list of all indexes defined over this type
     // Includes indexes defined on supertypes of this type
-    final ArrayList<FsIndex_iicp<FeatureStructure>> allIndexesForType = this.indexArray[typeCode].indexesForType;
+    final ArrayList<FsIndex_iicp<TOP>> allIndexesForType = this.indexArray[typeCode].indexesForType;
     for (FsIndex_iicp<? extends FeatureStructure> iicp : allIndexesForType) {
       iicp.fsIndex_singletype.flush();
     }
@@ -980,9 +981,9 @@ public class FSIndexRepositoryImpl imple
    * 
    * @return a stream all FSs in any defined index, in this view.
    */
-  public int[] getIndexedFSs() {
+  public List<TOP> getIndexedFSs() {
     
-    final IntVector v = new IntVector();  // accumulates fsAddrs from various indexes
+    final ArrayList<TOP> v = new ArrayList<>();  // accumulates fsAddrs from various indexes
     
     /* Iterate over index by type, with something in there
      * and dump all the fss found for that type (excluding subtypes) into v
@@ -991,7 +992,8 @@ public class FSIndexRepositoryImpl imple
     for (int i = 0; i < this.usedIndexes.size(); i++) {
       indexArray[this.usedIndexes.get(i)].getNonSetIndex().fsIndex_singletype.bulkAddTo(v); 
     }  
-    return v.toArray();
+   
+    return v;
   } 
 
   /* *****************************************
@@ -1012,7 +1014,7 @@ public class FSIndexRepositoryImpl imple
    * @see org.apache.uima.cas.FSIndexRepository#addFS(org.apache.uima.cas.FeatureStructure)
    */
   public <T extends FeatureStructure> void addFS(T fs) {
-    addFS_common(fs, false);
+    addFS_common((TOP)fs, false);
   }
 
   private void incrementIllegalIndexUpdateDetector(int typeCode) {
@@ -1023,7 +1025,7 @@ public class FSIndexRepositoryImpl imple
    * @see org.apache.uima.cas.FSIndexRepository#removeFS(org.apache.uima.cas.FeatureStructure)
    */
   public void removeFS(FeatureStructure fs) {
-    removeFS_ret((FeatureStructureImplC) fs, INCLUDE_BAG_INDEXES);
+    removeFS_ret((TOP) fs, INCLUDE_BAG_INDEXES);
   }
 
   public void removeFS(int fsRef) {
@@ -1069,11 +1071,11 @@ public class FSIndexRepositoryImpl imple
 
 
   
-  public <T extends FeatureStructure> void addback(T fs) {
+  public <T extends TOP> void addback(T fs) {
     addFS_common(fs, true);
   }
   
-  private <T extends FeatureStructure> void addFS_common(T fs, boolean isAddback) {
+  private <T extends TOP> void addFS_common(T fs, boolean isAddback) {
     cas.maybeClearCacheNotInIndex(fs);
     TypeImpl ti = ((FeatureStructureImplC)fs)._typeImpl;
     final int typeCode = ti.getCode();    
@@ -1086,7 +1088,9 @@ public class FSIndexRepositoryImpl imple
       // Check that the annotationBase FS is being added to the proper Cas View
       AnnotationBase fsAnnotBase = (AnnotationBase) fs;
       final Sofa sofa = fsAnnotBase.getSofa();   
-      if (cas.getSofa() != sofa) {        
+      if (cas.getSofa() != sofa) { 
+        /*  Error - the Annotation "{0}" is over view "{1}" and cannot be added to indexes associated with
+         * the different view "{2}" */
         throw new CASRuntimeException(CASRuntimeException.ANNOTATION_IN_WRONG_INDEX,  
                 fsAnnotBase.toString(), sofa.getSofaID(), cas.getSofa().getSofaID());
       }
@@ -1097,11 +1101,11 @@ public class FSIndexRepositoryImpl imple
     incrementIllegalIndexUpdateDetector(typeCode);
     
     // Get the indexes for the type.
-    final ArrayList<FsIndex_iicp<FeatureStructure>> indexes = this.indexArray[typeCode].indexesForType;
+    final ArrayList<FsIndex_iicp<TOP>> indexes = this.indexArray[typeCode].indexesForType;
     
     // Add fsRef to all indexes.
     boolean noIndexOrOnlySetindexes = true;
-    for (FsIndex_iicp<FeatureStructure> iicp : indexes) {
+    for (FsIndex_iicp<TOP> iicp : indexes) {
       
       // the indexes for the type are over the type and its subtypes.
       final int indexingStrategy = iicp.fsIndex_singletype.getIndexingStrategy(); 
@@ -1150,15 +1154,15 @@ public class FSIndexRepositoryImpl imple
     return "_" + type.getName() + "_GeneratedIndex";
   }
 
-  boolean removeFS_ret(FeatureStructureImplC fs, boolean skipBagIndexes) {
+  boolean removeFS_ret(TOP fs, boolean skipBagIndexes) {
     final int typeCode = fs._typeImpl.getCode();
     incrementIllegalIndexUpdateDetector(typeCode);
-    final ArrayList<FsIndex_iicp<FeatureStructure>> idxList = this.indexArray[typeCode].indexesForType;
+    final ArrayList<FsIndex_iicp<TOP>> idxList = this.indexArray[typeCode].indexesForType;
 
     int nbrRemoved = 0;
     
-    for (FsIndex_iicp<FeatureStructure> iicp : idxList) {
-      FsIndex_singletype<FeatureStructure> st = iicp.fsIndex_singletype;
+    for (FsIndex_iicp<TOP> iicp : idxList) {
+      FsIndex_singletype<TOP> st = iicp.fsIndex_singletype;
       if (skipBagIndexes && !st.isSetOrSorted()) {
         continue;
       }
@@ -1187,7 +1191,7 @@ public class FSIndexRepositoryImpl imple
    * @see org.apache.uima.cas.FSIndexRepository#getAllIndexedFS(org.apache.uima.cas.Type)
    */
   public <T extends FeatureStructure> FSIterator<T> getAllIndexedFS(Type type) {
-    final ArrayList<FSIterator<T>> iteratorList = new ArrayList<>();
+    final ArrayList<LowLevelIterator<T>> iteratorList = new ArrayList<>();
     getAllIndexedFS(type, iteratorList);
     final int iteratorListSize = iteratorList.size();
     if (iteratorListSize == 0) {
@@ -1197,11 +1201,12 @@ public class FSIndexRepositoryImpl imple
       return iteratorList.get(0);
     }
     
-    FSIterator<T>[] ia = new FSIterator[iteratorListSize];
+    
+    LowLevelIterator<T>[] ia = new LowLevelIterator[iteratorListSize];
     return new FsIterator_aggregation_common<T>(iteratorList.toArray(ia), null);
   }
 
-  private final <T extends FeatureStructure> void getAllIndexedFS(Type type, List<FSIterator<T>> iteratorList) {
+  private final <T extends FeatureStructure> void getAllIndexedFS(Type type, List<LowLevelIterator<T>> iteratorList) {
     // Strategy:  go through the list of all indexes for this type.
     //   The list is intentionally ordered when created to have "SORTED" indexes come first.
     //   
@@ -1215,10 +1220,10 @@ public class FSIndexRepositoryImpl imple
     //     and only a SET index was defined, see https://issues.apache.org/jira/browse/UIMA-4111
 
     // get all indexes for this type    
-    FsIndex_iicp<FeatureStructure> iicp = getIndexesForType(((TypeImpl)type).getCode()).getNonSetIndex();  
+    FsIndex_iicp<TOP> iicp = getIndexesForType(((TypeImpl)type).getCode()).getNonSetIndex();  
     
-    if (null != iicp) {
-      iteratorList.add((FSIterator<T>) iicp.iterator());
+    if (null != iicp && !iicp.isEmpty()) {
+      iteratorList.add((LowLevelIterator<T>) iicp.iterator());
       if (iicp.isDefaultBagIndex()) {
         // We found one of the special auto-indexes which don't inherit down the tree. So, we
         // manually need to traverse the inheritance tree to look for more indexes. Note that
@@ -1237,7 +1242,7 @@ public class FSIndexRepositoryImpl imple
     addDirectSubtypes(type, iteratorList);
   }
   
-  private <T extends FeatureStructure> void addDirectSubtypes(Type type, List<FSIterator<T>> iteratorList) {
+  private <T extends FeatureStructure> void addDirectSubtypes(Type type, List<LowLevelIterator<T>> iteratorList) {
     ((TypeImpl)type).getDirectSubtypes().stream().forEach(subType -> getAllIndexedFS(subType, iteratorList));
   }
     
@@ -1321,7 +1326,7 @@ public class FSIndexRepositoryImpl imple
    * @return true if this fs was in the indexes and will need to be added back.
    */
   boolean removeIfInCorrputableIndexInThisView(FeatureStructure afs) {
-    FeatureStructureImplC fs = (FeatureStructureImplC) afs;
+    TOP fs = (TOP) afs;
     TypeImpl ti = fs._typeImpl;
     final IndexesForType i4t = indexArray[ti.getCode()];
  
@@ -1357,7 +1362,7 @@ public class FSIndexRepositoryImpl imple
    * @param typeCode
    * @return the index for that type
    */
-  <T extends AnnotationFS> FsIndex_annotation<T> getAnnotationIndex(TypeImpl ti) {
+  <T extends Annotation> FsIndex_annotation<T> getAnnotationIndex(TypeImpl ti) {
 //    assert(ti.isAnnotationType());
     FsIndex_annotation<Annotation> r = annotationIndexes.get(ti);
     if (r != null) { 
@@ -1367,7 +1372,7 @@ public class FSIndexRepositoryImpl imple
     final FsIndex_iicp<? extends FeatureStructure> annotation_iicp = this.name2indexMap.get(CAS.STD_ANNOTATION_INDEX);
     final FSIndexComparator comp = annotation_iicp.fsIndex_singletype.getComparatorForIndexSpecs();
 
-    final ArrayList<FsIndex_iicp<FeatureStructure>> iicps_for_type = getIndexesForType(ti.getCode()).indexesForType;
+    final ArrayList<FsIndex_iicp<TOP>> iicps_for_type = getIndexesForType(ti.getCode()).indexesForType;
     
     // search all defined indexes for this type, to find an annotation one
     final int ii = findIndex(iicps_for_type, comp, FSIndex.SORTED_INDEX);

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSsTobeAddedback.java Mon Nov  9 19:36:35 2015
@@ -26,6 +26,7 @@ import java.util.Map.Entry;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.uima.cas.FSIndexRepository;
+import org.apache.uima.jcas.cas.TOP;
 
 
 /**
@@ -94,8 +95,8 @@ abstract class FSsTobeAddedback implemen
       throw new UnsupportedOperationException();
     }
   }
-  void recordRemove(FeatureStructureImplC fs, FSIndexRepositoryImpl view) {throw new UnsupportedOperationException();}
-  void recordRemove(FeatureStructureImplC fs, FSIndexRepositoryImpl view, int count) {
+  void recordRemove(TOP fs, FSIndexRepositoryImpl view) {throw new UnsupportedOperationException();}
+  void recordRemove(TOP fs, FSIndexRepositoryImpl view, int count) {
     if (count == 1) {
       recordRemove(fs, view);
     } else { 
@@ -104,7 +105,7 @@ abstract class FSsTobeAddedback implemen
   }
   
   void addback()                         {throw new UnsupportedOperationException();}
-  void addback(FeatureStructureImplC fs) {throw new UnsupportedOperationException();}
+  void addback(TOP fs) {throw new UnsupportedOperationException();}
   abstract void clear();
 
   static class FSsTobeAddedbackSingle extends FSsTobeAddedback {
@@ -117,12 +118,12 @@ abstract class FSsTobeAddedback implemen
     }
     
     @Override
-    void recordRemove(FeatureStructureImplC fs, FSIndexRepositoryImpl view) {
+    void recordRemove(TOP fs, FSIndexRepositoryImpl view) {
       recordRemove(view);
     }
     
     @Override
-    void recordRemove(FeatureStructureImplC fs, FSIndexRepositoryImpl view, int count) {
+    void recordRemove(TOP fs, FSIndexRepositoryImpl view, int count) {
       if (count != 1) {
         throw new RuntimeException("internal error");
       }
@@ -130,7 +131,7 @@ abstract class FSsTobeAddedback implemen
     }
           
     @Override
-    void addback(FeatureStructureImplC fs) {
+    void addback(TOP fs) {
       for (FSIndexRepositoryImpl ir : views) {
         ir.addback(fs);
       }
@@ -146,7 +147,7 @@ abstract class FSsTobeAddedback implemen
   
   static class FSsTobeAddedbackMultiple extends FSsTobeAddedback {
   
-    final Map<FeatureStructureImplC, List<?>> fss2views = new HashMap<FeatureStructureImplC, List<?>>();
+    final Map<TOP, List<?>> fss2views = new HashMap<TOP, List<?>>();
     
     final CASImpl cas;
     
@@ -155,7 +156,7 @@ abstract class FSsTobeAddedback implemen
     }
     
     @Override
-    void recordRemove(FeatureStructureImplC fs, FSIndexRepositoryImpl view) {
+    void recordRemove(TOP fs, FSIndexRepositoryImpl view) {
       log(fs, view);
       @SuppressWarnings("unchecked")
       List<FSIndexRepositoryImpl> irList = (List<FSIndexRepositoryImpl>) fss2views.get(fs);
@@ -167,8 +168,8 @@ abstract class FSsTobeAddedback implemen
           
     @Override
     void addback() {
-      for (Entry<FeatureStructureImplC, List<?>> e : fss2views.entrySet()) {
-        final FeatureStructureImplC fs = e.getKey();
+      for (Entry<TOP, List<?>> e : fss2views.entrySet()) {
+        final TOP fs = e.getKey();
         @SuppressWarnings("unchecked")
         final List<FSIndexRepositoryImpl> views = (List<FSIndexRepositoryImpl>) e.getValue();
         for (FSIndexRepositoryImpl ir : views) {

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureStructureImplC.java Mon Nov  9 19:36:35 2015
@@ -19,9 +19,6 @@
 
 package org.apache.uima.cas.impl;
 
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -30,7 +27,6 @@ import java.util.function.IntFunction;
 
 import org.apache.uima.cas.CAS;
 import org.apache.uima.cas.CASRuntimeException;
-import org.apache.uima.cas.CommonArrayFS;
 import org.apache.uima.cas.Feature;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.SofaFS;
@@ -59,6 +55,7 @@ import org.apache.uima.jcas.cas.JavaObje
 import org.apache.uima.jcas.cas.LongArray;
 import org.apache.uima.jcas.cas.ShortArray;
 import org.apache.uima.jcas.cas.StringArray;
+import org.apache.uima.jcas.cas.TOP;
 import org.apache.uima.jcas.impl.JCasImpl;
 import org.apache.uima.util.Misc;
 
@@ -165,7 +162,7 @@ public class FeatureStructureImplC imple
     c = _typeImpl.nbrOfUsedRefDataSlots;
     _refData = (c == 0) ? null : new Object[c];
     
-    _id = _casView.setId2fs(this);    
+    _id = _casView.setId2fs(this);   
   }
   
   
@@ -342,11 +339,11 @@ public class FeatureStructureImplC imple
       throw new CASRuntimeException(CASRuntimeException.INAPPROP_RANGE, fi.getName(), "int", fi.getRange().getName());
     }
     if (IS_ENABLE_RUNTIME_FEATURE_VALIDATION) featureValidation(fi);
-    _casView.setWithCheckAndJournal(this, fi.getCode(), () -> _intData[fi.getAdjustedOffset()] = v); 
+    _casView.setWithCheckAndJournal((TOP)this, fi.getCode(), () -> _intData[fi.getAdjustedOffset()] = v); 
   }
 
   protected void setRefValueCJ(FeatureImpl feat, Object v) {
-    _casView.setWithCheckAndJournal(this, feat.getCode(), () -> _refData[feat.getAdjustedOffset()] = v); 
+    _casView.setWithCheckAndJournal((TOP)this, feat.getCode(), () -> _refData[feat.getAdjustedOffset()] = v); 
   }
 
   @Override
@@ -592,11 +589,11 @@ public class FeatureStructureImplC imple
   }
 
   @Override
-  public FeatureStructure getFeatureValue(Feature feat) {
+  public TOP getFeatureValue(Feature feat) {
     FeatureImpl fi = (FeatureImpl) feat;
-    Object getter =  fi.getJCasSetter();
-    return (getter != null) ? ((JCas_getter_generic<FeatureStructure>)getter).get(this)
-                            : (FeatureStructure) getJavaObjectValue(feat);
+    Object getter =  fi.getJCasGetter();
+    return (getter != null) ? ((JCas_getter_generic<TOP>)getter).get(this)
+                            : (TOP) getJavaObjectValue(feat);
   }
 
   @Override

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_annotation.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_annotation.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_annotation.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_annotation.java Mon Nov  9 19:36:35 2015
@@ -24,13 +24,14 @@ import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.cas.text.AnnotationIndex;
 import org.apache.uima.cas.text.AnnotationTree;
+import org.apache.uima.jcas.tcas.Annotation;
 
 /**
  * Implementation of annotation indexes.
  * Implements AnnotationIndex
  * replaces AnnotationIndexImpl in v2
  */
-public class FsIndex_annotation <T extends AnnotationFS> 
+public class FsIndex_annotation <T extends Annotation> 
                  extends FsIndex_iicp<T> 
                  implements AnnotationIndex<T> {
   

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_bag.java Mon Nov  9 19:36:35 2015
@@ -25,8 +25,8 @@ import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.admin.FSIndexComparator;
-import org.apache.uima.internal.util.IntVector;
 import org.apache.uima.internal.util.ObjHashSet;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * Used for UIMA FS Bag Indexes
@@ -34,17 +34,17 @@ import org.apache.uima.internal.util.Obj
  * @param <T> the Java cover class type for this index, passed along to (wrapped) iterators producing Java cover classes
  * NOTE: V3 doesn't support ALLOW_DUP_ADD_TO_INDEXES
  */
-public class FsIndex_bag<T extends FeatureStructure> extends FsIndex_singletype<T> {
+public class FsIndex_bag<T extends TOP> extends FsIndex_singletype<T> {
   
 //  // package private
 //  final static boolean USE_POSITIVE_INT_SET = !FSIndexRepositoryImpl.IS_ALLOW_DUP_ADD_2_INDEXES;
 
   // The index
-  final private ObjHashSet<FeatureStructureImplC> index;
+  final private ObjHashSet<TOP> index;
   
   FsIndex_bag(CASImpl cas, Type type, int initialSize, int indexType) {
     super(cas, type, indexType);
-    this.index = new ObjHashSet<FeatureStructureImplC>(initialSize, FeatureStructureImplC.class);
+    this.index = new ObjHashSet<TOP>(initialSize, TOP.class);
   }
 
   /**
@@ -70,7 +70,7 @@ public class FsIndex_bag<T extends Featu
 
   @Override
   public final boolean insert(T fs) {
-    return index.add((FeatureStructureImplC) fs);
+    return index.add((TOP) fs);
   }
 
   @SuppressWarnings("unchecked")
@@ -82,7 +82,8 @@ public class FsIndex_bag<T extends Featu
    * Override the super impl which uses comparators.
    * For bag indexes, compare equal only if identical addresses
    */
-  public int compare(FeatureStructure fs1, FeatureStructure fs2) {
+  @Override
+  public int compare(TOP fs1, TOP fs2) {
     return (fs1 == fs2) ? 0 : (fs1.id() < fs2.id()) ? -1 : 1;
   }
 
@@ -144,7 +145,7 @@ public class FsIndex_bag<T extends Featu
    */
   @Override
   public T find(FeatureStructure fs) {
-    final int resultAddr =  this.index.find((FeatureStructureImplC) fs);
+    final int resultAddr =  this.index.find((TOP) fs);
     if (resultAddr >= 0) {
       return (T) fs;
     }
@@ -163,7 +164,8 @@ public class FsIndex_bag<T extends Featu
    * only for backwards compatibility
    * 
    */
-  public boolean deleteFS(FeatureStructure fs) {
+  @Override
+  public boolean deleteFS(T fs) {
     return this.index.remove(fs);
   }
   
@@ -177,14 +179,9 @@ public class FsIndex_bag<T extends Featu
   }
 
   @Override
-  protected void bulkAddTo(List<FeatureStructure> fss) {
+  protected void bulkAddTo(List<TOP> fss) {
     fss.addAll(this.index);
   }
-
-  @Override
-  protected void bulkAddTo(IntVector fss) {
-    this.index.stream().mapToInt(FeatureStructureImplC::id).forEach(fss::add);
-  }
   
   /* (non-Javadoc)
    * @see org.apache.uima.cas.FSIndex#iterator()
@@ -221,7 +218,7 @@ public class FsIndex_bag<T extends Featu
     return (T) index.get(itPos);
   }
   
-  ObjHashSet<FeatureStructureImplC> getObjHashSet() {
+  ObjHashSet<TOP> getObjHashSet() {
     return index;
   }
   

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_flat.java Mon Nov  9 19:36:35 2015
@@ -28,6 +28,7 @@ import java.util.List;
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.internal.util.IntVector;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * Common part of flattened indexes, used for both snapshot iterators and 
@@ -35,14 +36,14 @@ import org.apache.uima.internal.util.Int
  *  
  * @param <T> the Java class type for this index
  */
-public class FsIndex_flat<T extends FeatureStructure> extends FsIndex_singletype<T> {
+public class FsIndex_flat<T extends TOP> extends FsIndex_singletype<T> {
 
   // The index, an array.
-  final private FeatureStructureImplC[] indexedFSs;
+  final private TOP[] indexedFSs;
   
   final private FsIndex_iicp<T> iicp;
   
-  final private Comparator<FeatureStructure> comparator;
+  final private Comparator<TOP> comparator;
     
   FsIndex_flat(FsIndex_iicp<T> iicp) {
     super(iicp.getCASImpl(), iicp.fsIndex_singletype.getType(), iicp.fsIndex_singletype.getIndexingStrategy());
@@ -55,14 +56,14 @@ public class FsIndex_flat<T extends Feat
    * Flat array filled, ordered
    * @param flatArray the array to fill
    */
-  private FeatureStructureImplC[] fillFlatArray() {
+  private TOP[] fillFlatArray() {
     
-    FeatureStructureImplC[] a =  (FeatureStructureImplC[]) Array.newInstance(FeatureStructureImplC.class, iicp.size());
+    TOP[] a =  (TOP[]) Array.newInstance(TOP.class, iicp.size());
     
     FSIterator<T> it = iicp.iterator();
     int i = 0;
     while (it.hasNext()) {
-      a[i++] = (FeatureStructureImplC) it.next();
+      a[i++] = it.next();
     }
     
     if (i != a.length) {
@@ -111,8 +112,8 @@ public class FsIndex_flat<T extends Feat
   @Override
   public T find(FeatureStructure fs) {
     if (isSorted()) {
-      for (FeatureStructureImplC item : indexedFSs) {
-        if (comparator.compare(item,  fs) == 0) {
+      for (TOP item : indexedFSs) {
+        if (comparator.compare(item,  (TOP)fs) == 0) {
           return (T) item;
         }
       }
@@ -121,7 +122,7 @@ public class FsIndex_flat<T extends Feat
 
     // ordered case
     // r is index if found, otherwise, (-(insertion point) - 1). 
-    int r = Arrays.binarySearch(indexedFSs,  fs, comparator);
+    int r = Arrays.binarySearch(indexedFSs,  (TOP)fs, comparator);
     return (r >= 0) ? (T) indexedFSs[r] : null;
   }
 
@@ -162,11 +163,11 @@ public class FsIndex_flat<T extends Feat
    * @see org.apache.uima.cas.impl.FsIndex_singletype#bulkAddTo(java.util.List)
    */
   @Override
-  protected void bulkAddTo(List<FeatureStructure> v) {
+  protected void bulkAddTo(List<TOP> v) {
     v.addAll(Arrays.asList(indexedFSs));
   }
   
-  @Override
+  // maybe needed for backwards compatibility for now
   protected void bulkAddTo(IntVector v) {
     Arrays.stream(indexedFSs).mapToInt(FeatureStructureImplC::id).forEach(v::add);
   }
@@ -176,7 +177,12 @@ public class FsIndex_flat<T extends Feat
    */    
   @Override
   public int compare(FeatureStructure fs1, FeatureStructure fs2) {
-    return comparator.compare(fs1,  fs2);
+    return comparator.compare((TOP)fs1,  (TOP)fs2);
+  }
+  
+  @Override
+  public int compare(TOP fs1, TOP fs2) {
+    return comparator.compare(fs1, fs2);
   }
 
 

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_iicp.java Mon Nov  9 19:36:35 2015
@@ -9,6 +9,7 @@ import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.admin.FSIndexComparator;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * FsIndex_iicp (iicp)
@@ -27,11 +28,10 @@ import org.apache.uima.cas.admin.FSIndex
  * This class is package private to share with FSIndexFlat
  * For Internal Use
  */  
-class FsIndex_iicp<T extends FeatureStructure> 
-          implements Comparable<FsIndex_iicp<? extends FeatureStructure>>,
+class FsIndex_iicp<T extends TOP> 
+          implements Comparable<FsIndex_iicp<? extends TOP>>,
                      Comparator<T>,
-                     LowLevelIndex<T>
-                      {
+                     LowLevelIndex<T> {
 
 //  private final static boolean DEBUG = false;
 
@@ -49,7 +49,7 @@ class FsIndex_iicp<T extends FeatureStru
    * 
    * This is set up lazily on first need, to avoid extra work when won't be accessed
    */
-  ArrayList<FsIndex_singletype<FeatureStructure>> cachedSubFsLeafIndexes = null;
+  ArrayList<FsIndex_singletype<TOP>> cachedSubFsLeafIndexes = null;
   
   // VOLATILE to permit double-checked locking technique
   private volatile boolean isIteratorCacheSetup = false;
@@ -74,7 +74,7 @@ class FsIndex_iicp<T extends FeatureStru
     } else {  
       int len = Math.min(3,  cachedSubFsLeafIndexes.size());
       for (int i = 0; i < len; i++) {
-        FsIndex_singletype<FeatureStructure> lii = cachedSubFsLeafIndexes.get(i); 
+        FsIndex_singletype<TOP> lii = cachedSubFsLeafIndexes.get(i); 
         sb.append("  cache ").append(i++);
         sb.append("  ").append(lii).append('\n');
       }
@@ -136,7 +136,7 @@ class FsIndex_iicp<T extends FeatureStru
       final int indexKind = this.getIndexingStrategy();
       int size = (indexKind == FSIndex.DEFAULT_BAG_INDEX) ? 1 : 1 + (int) rootType.getAllSubtypes().count();
 
-      final ArrayList<FsIndex_singletype<FeatureStructure>> tempSubIndexCache = new ArrayList<FsIndex_singletype<FeatureStructure>>();
+      final ArrayList<FsIndex_singletype<TOP>> tempSubIndexCache = new ArrayList<FsIndex_singletype<TOP>>();
       sortedTypeCodes = (indexKind == FSIndex.SORTED_INDEX) ? new int[size] : null;
 
       initOneType(rootType, tempSubIndexCache, indexKind);
@@ -170,11 +170,11 @@ class FsIndex_iicp<T extends FeatureStru
     }  // end of synchronized block
   }
   
-  private void initOneType(TypeImpl ti, ArrayList<FsIndex_singletype<FeatureStructure>> cache, int indexKind) {
-    ArrayList<FsIndex_iicp<FeatureStructure>> ift = 
+  private void initOneType(TypeImpl ti, ArrayList<FsIndex_singletype<TOP>> cache, int indexKind) {
+    ArrayList<FsIndex_iicp<TOP>> ift = 
         fsIndexRepositoryImpl.getIndexesForType(ti.getCode()).indexesForType;
     
-    FsIndex_singletype<FeatureStructure> singleIndex = ift.get(ift.indexOf(this)).fsIndex_singletype;
+    FsIndex_singletype<TOP> singleIndex = ift.get(ift.indexOf(this)).fsIndex_singletype;
     
     if (indexKind == FSIndex.SORTED_INDEX) {
       sortedTypeCodes[cache.size()] = singleIndex.getTypeCode();
@@ -198,7 +198,7 @@ class FsIndex_iicp<T extends FeatureStru
    * @see java.lang.Comparable#compareTo(Object)
    * 
    */
-  public int compareTo(FsIndex_iicp<? extends FeatureStructure> cp) {
+  public int compareTo(FsIndex_iicp<? extends TOP> cp) {
     final int typeCode1 = ((TypeImpl) this.fsIndex_singletype.getType()).getCode();
     final int typeCode2 = ((TypeImpl) cp.fsIndex_singletype.getType()).getCode();
     if (typeCode1 < typeCode2) {
@@ -220,9 +220,19 @@ class FsIndex_iicp<T extends FeatureStru
     return cachedSubFsLeafIndexes.stream().mapToInt(iicp -> iicp.size()).sum();
   }
   
+  public boolean isEmpty() {
+    createIndexIteratorCache();  
+    for (FsIndex_singletype<TOP> index : cachedSubFsLeafIndexes) {
+      if (index.size() > 0) {
+        return false;
+      }
+    }
+    return true;
+  }
+  
   boolean has1OrMoreEntries() {
     createIndexIteratorCache();  // does nothing if already created
-    final ArrayList<FsIndex_singletype<FeatureStructure>> localIc = this.cachedSubFsLeafIndexes;
+    final ArrayList<FsIndex_singletype<TOP>> localIc = this.cachedSubFsLeafIndexes;
     final int len = localIc.size();
     for (int i = 0; i < len; i++) {
       if (localIc.get(i).size() > 0) {
@@ -242,7 +252,7 @@ class FsIndex_iicp<T extends FeatureStru
    * @return a guess at the size, done quickly
    */
   int guessedSize() {
-    final ArrayList<FsIndex_singletype<FeatureStructure>> localIc = this.cachedSubFsLeafIndexes;
+    final ArrayList<FsIndex_singletype<TOP>> localIc = this.cachedSubFsLeafIndexes;
     final int len = localIc.size();
     final int lim = Math.min(3, len);
     int size = 0;
@@ -310,9 +320,9 @@ class FsIndex_iicp<T extends FeatureStru
 //      }
 //    }
   
-  FsIndex_singletype<FeatureStructure> getNoSubtypeIndexForType(Type type) {
+  FsIndex_singletype<TOP> getNoSubtypeIndexForType(Type type) {
     createIndexIteratorCache();
-    for (FsIndex_singletype<FeatureStructure> noSubtypeIndex : cachedSubFsLeafIndexes) {
+    for (FsIndex_singletype<TOP> noSubtypeIndex : cachedSubFsLeafIndexes) {
       if (noSubtypeIndex.getType() == type) {
         return noSubtypeIndex;
       }
@@ -355,7 +365,12 @@ class FsIndex_iicp<T extends FeatureStru
   public int compare(FeatureStructure fs1, FeatureStructure fs2) {
     return fsIndex_singletype.compare(fs1,  fs2);
   }
-
+  
+  @Override
+  public int compare(TOP fs1, TOP fs2) {
+    return fsIndex_singletype.compare(fs1,  fs2);
+  }
+  
   @Override
   public boolean contains(FeatureStructure fs) {
     return find(fs) != null;
@@ -365,7 +380,7 @@ class FsIndex_iicp<T extends FeatureStru
   public T find(FeatureStructure fs) {
     createIndexIteratorCache();  // does nothing if already created
     
-    for (FsIndex_singletype<FeatureStructure> idx : cachedSubFsLeafIndexes) {
+    for (FsIndex_singletype<TOP> idx : cachedSubFsLeafIndexes) {
      FeatureStructure result = idx.find(fs);
       if (result != null) {
         return (T) result;

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_set_sorted.java Mon Nov  9 19:36:35 2015
@@ -27,7 +27,7 @@ import java.util.TreeSet;
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.Type;
-import org.apache.uima.internal.util.IntVector;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * Common index impl for set and sorted indexes.
@@ -47,21 +47,21 @@ import org.apache.uima.internal.util.Int
  * 
  * @param <T> the Java class type for this index
  */
-public class FsIndex_set_sorted<T extends FeatureStructure> extends FsIndex_singletype<T> {
+public class FsIndex_set_sorted<T extends TOP> extends FsIndex_singletype<T> {
 
   // The index, a NavigableSet. 
   // Should be over T, but has to be over FeatureStructure in order to have the comparator take FeatureStructures
-  final private NavigableSet<FeatureStructure> indexedFSs;
+  final private NavigableSet<TOP> indexedFSs;
    
   FsIndex_set_sorted(CASImpl cas, Type type, int indexType, boolean useSorted) {
     super(cas, type, indexType);
     this.indexedFSs = useSorted 
-                        ?  new TreeSet<FeatureStructure>(
-                            (FeatureStructure o1, FeatureStructure o2) -> {
+                        ?  new TreeSet<TOP>(
+                            (TOP o1, TOP o2) -> {
                               final int c = compare(o1,  o2); 
                               // augment normal comparator with one that compares IDs if everything else equal
                               return (c == 0) ? (Integer.compare(o1.id(), o2.id())) : c;})
-                        : new TreeSet<FeatureStructure>( (FeatureStructure o1, FeatureStructure o2) -> compare(o1,  o2));     
+                        : new TreeSet<TOP>( (TOP o1, TOP o2) -> compare(o1,  o2));     
   }
 
   @Override
@@ -94,7 +94,7 @@ public class FsIndex_set_sorted<T extend
    */
   @Override
   boolean insert(T fs) {
-    return this.indexedFSs.add(fs);
+    return this.indexedFSs.add((TOP)fs);
   }
 
   /**
@@ -116,12 +116,13 @@ public class FsIndex_set_sorted<T extend
    * @return an arbitrary fs that matches 
    */
   @Override
-  public T find(FeatureStructure templateKey) {
+  public T find(FeatureStructure templateKeyIn) {
+    TOP templateKey = (TOP) templateKeyIn;
     if (null == templateKey || this.indexedFSs.size() == 0) {
       return null;
     }
     T found;
-    FeatureStructure fs1GEfs = this.indexedFSs.ceiling(templateKey);
+    TOP fs1GEfs = this.indexedFSs.ceiling(templateKey);
     
     if (fs1GEfs == null) {  // then all elements are less-that the templateKey
       found = (T) indexedFSs.lower(templateKey);  //highest of elements less-than the template key
@@ -140,7 +141,7 @@ public class FsIndex_set_sorted<T extend
     return (found == null) ? null : (compare(found, templateKey) == 0) ? found : null;
   }
 
-  public T findLeftmost(FeatureStructure templateKey) {
+  public T findLeftmost(TOP templateKey) {
     // descending iterator over elements LessThan templateKey
     Iterator<T> it = (Iterator<T>) indexedFSs.headSet(templateKey, false).descendingIterator();
   
@@ -182,16 +183,16 @@ public class FsIndex_set_sorted<T extend
   }
   
   @Override
-  protected void bulkAddTo(List<FeatureStructure> v) {
+  protected void bulkAddTo(List<TOP> v) {
     v.addAll(indexedFSs);
   }
   
-  @Override
-  protected void bulkAddTo(IntVector v) {
-    this.indexedFSs.stream().mapToInt(fs -> ((FeatureStructureImplC)fs).id()).forEach(v::add);
-  }
+//  @Override
+//  protected void bulkAddTo(IntVector v) {
+//    this.indexedFSs.stream().mapToInt(fs -> ((FeatureStructureImplC)fs).id()).forEach(v::add);
+//  }
   
-  NavigableSet<FeatureStructure> getNavigableSet() { //used by FsIterator_sorted to compute various derivitive nav sets
+  NavigableSet<TOP> getNavigableSet() { //used by FsIterator_sorted to compute various derivitive nav sets
     return indexedFSs;
   }
    

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIndex_singletype.java Mon Nov  9 19:36:35 2015
@@ -28,7 +28,7 @@ import org.apache.uima.cas.FeatureStruct
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.admin.FSIndexComparator;
 import org.apache.uima.cas.admin.LinearTypeOrder;
-import org.apache.uima.internal.util.IntVector;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * The common (among all index kinds - set, sorted, bag) info for an index over 1 type (excluding subtypes)
@@ -37,7 +37,7 @@ import org.apache.uima.internal.util.Int
  * 
  * @param <T> the Java cover class type for this index, passed along to (wrapped) iterators producing Java cover classes
  */
-public abstract class FsIndex_singletype<T extends FeatureStructure> implements Comparator<FeatureStructure>, LowLevelIndex<T> {
+public abstract class FsIndex_singletype<T extends TOP> implements Comparator<TOP>, LowLevelIndex<T> {
 
   private final static String[] indexTypes = new String[] {"Sorted", "Set", "Bag", "DefaultBag"}; 
 
@@ -129,7 +129,7 @@ public abstract class FsIndex_singletype
     fsIt.moveTo(initialPositionFs);
     return fsIt;
   }
-  
+    
   @Override
   public FSIndexComparator getComparatorForIndexSpecs() {
     return this.comparatorForIndexSpecs;
@@ -199,23 +199,26 @@ public abstract class FsIndex_singletype
     return compare(casImpl.getFsFromId_checked(fs1), casImpl.getFsFromId_checked(fs2));
   }
   
+  @Override
+  public int compare(FeatureStructure fs1, FeatureStructure fs2) {
+    return compare((TOP) fs1, (TOP) fs2);
+  }
+  
   /**
    * @see org.apache.uima.cas.FSIndex#compare(T, T)
    */    
   @Override
-  public int compare(FeatureStructure fs1, FeatureStructure fs2) {
+  public int compare(TOP fs1, TOP fs2) {
   
     if (fs1 == fs2) {
       return 0;
     }
-    final FeatureStructureImplC fsc1 = (FeatureStructureImplC) fs1;
-    final FeatureStructureImplC fsc2 = (FeatureStructureImplC) fs2;
-        
+    
     /**
      * for each key:
      *   if Feature:
      *     Switch by type:  float, 
-     *       get the value:  fsc1.getXXX, compare
+     *       get the value:  fs1.getXXX, compare
      */
     int i = -1;
     for (Object key : keys) {
@@ -225,30 +228,30 @@ public abstract class FsIndex_singletype
         FeatureImpl fi = (FeatureImpl) key;
         switch (keyTypeCodes[i]) {
         case TypeSystemImpl.booleanTypeCode:
-          result = Integer.compare(fsc1.getBooleanValue(fi) ? 1 : 0,
-                                   fsc2.getBooleanValue(fi) ? 1 : 0);
+          result = Integer.compare(fs1.getBooleanValue(fi) ? 1 : 0,
+                                   fs2.getBooleanValue(fi) ? 1 : 0);
           break;
         case TypeSystemImpl.byteTypeCode:
-          result = Integer.compare(fsc1.getByteValue(fi), fsc2.getByteValue(fi));
+          result = Integer.compare(fs1.getByteValue(fi), fs2.getByteValue(fi));
           break;
         case TypeSystemImpl.shortTypeCode:
-          result = Integer.compare(fsc1.getShortValue(fi), fsc2.getShortValue(fi));
+          result = Integer.compare(fs1.getShortValue(fi), fs2.getShortValue(fi));
           break;
         case TypeSystemImpl.intTypeCode:
-          result = Integer.compare(fsc1.getIntValue(fi), fsc2.getIntValue(fi));
+          result = Integer.compare(fs1.getIntValue(fi), fs2.getIntValue(fi));
           break;
         case TypeSystemImpl.longTypeCode:
-          result = Long.compare(fsc1.getLongValue(fi), fsc2.getLongValue(fi));
+          result = Long.compare(fs1.getLongValue(fi), fs2.getLongValue(fi));
           break;
         case TypeSystemImpl.floatTypeCode:
-          result = Float.compare(fsc1.getFloatValue(fi), fsc2.getFloatValue(fi));
+          result = Float.compare(fs1.getFloatValue(fi), fs2.getFloatValue(fi));
           break;
         case TypeSystemImpl.doubleTypeCode:
-          result = Double.compare(fsc1.getDoubleValue(fi), fsc2.getDoubleValue(fi));
+          result = Double.compare(fs1.getDoubleValue(fi), fs2.getDoubleValue(fi));
           break;
         case TypeSystemImpl.stringTypeCode:
-          String s1 = fsc1.getStringValue(fi);
-          String s2 = fsc1.getStringValue(fi);
+          String s1 = fs1.getStringValue(fi);
+          String s2 = fs1.getStringValue(fi);
           result = (s1 == null)
                    ? ((s2 == null) ? 0 : -1)   // s1 null is lessthan a non-null s2
                    : ( (s2 == null)            
@@ -257,7 +260,7 @@ public abstract class FsIndex_singletype
           break;         
         }
       } else {  // is type order compare    
-        result = ((LinearTypeOrder) key).compare(fsc1, fsc2);
+        result = ((LinearTypeOrder) key).compare(fs1, fs2);
       }
         
       if (result == 0) {
@@ -316,9 +319,7 @@ public abstract class FsIndex_singletype
    * For serialization: get all the items in this index and bulk add to an List<T>
    * @param v the set of items to add
    */
-  protected abstract void bulkAddTo(List<FeatureStructure> v);
-  
-  protected abstract void bulkAddTo(IntVector v);
+  protected abstract void bulkAddTo(List<TOP> v);
   
   @Override
   public LowLevelIterator<T> ll_iterator(boolean ambiguous) {

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_bag.java Mon Nov  9 19:36:35 2015
@@ -21,11 +21,11 @@ package org.apache.uima.cas.impl;
 
 import java.util.NoSuchElementException;
 
-import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.internal.util.ObjHashSet;
+import org.apache.uima.jcas.cas.TOP;
 
-class FsIterator_bag<T extends FeatureStructure> extends FsIterator_singletype<T> {
+class FsIterator_bag<T extends TOP> extends FsIterator_singletype<T> {
 
   private ObjHashSet<T> bag;
   

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_set_sorted.java Mon Nov  9 19:36:35 2015
@@ -25,13 +25,14 @@ import java.util.NavigableSet;
 import java.util.NoSuchElementException;
 
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
 
-class FsIterator_set_sorted<T extends FeatureStructure> extends FsIterator_singletype<T> {
+class FsIterator_set_sorted<T extends TOP> extends FsIterator_singletype<T> {
 
   // We use FeatureStructure instead of T because the 
   // signature of getting a "matching" element limits the type to the declared type, and 
   // in UIMA we can use, say an Annotation instance as a moveTo arg, for a navSet of some subtype of Annotation.
-  final private NavigableSet<FeatureStructure> navSet;  // == fsSortIndex.getNavigableSet()
+  final private NavigableSet<TOP> navSet;  // == fsSortIndex.getNavigableSet()
   
   final private FsIndex_set_sorted<T> fsSetSortIndex;
   
@@ -51,7 +52,7 @@ class FsIterator_set_sorted<T extends Fe
 
   private Iterator<T> iterator; 
   
-  FsIterator_set_sorted(FsIndex_set_sorted<T> fsSetSortIndex, int[] detectIllegalIndexUpdates, int typeCode, Comparator<FeatureStructure> comp) {
+  FsIterator_set_sorted(FsIndex_set_sorted<T> fsSetSortIndex, int[] detectIllegalIndexUpdates, int typeCode, Comparator<TOP> comp) {
     super(detectIllegalIndexUpdates, typeCode, comp);
     this.fsSetSortIndex = fsSetSortIndex;
     this.navSet = fsSetSortIndex.getNavigableSet();
@@ -158,7 +159,8 @@ class FsIterator_set_sorted<T extends Fe
    * @param fs the template FS indicating the position
    */
   @Override
-  public void moveTo(FeatureStructure fs) {
+  public void moveTo(FeatureStructure fsIn) {
+    TOP fs = (TOP) fsIn;
     isGoingForward = true;
     isCurrentElementFromLastGet = false;
     currentElement = null;

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_singletype.java Mon Nov  9 19:36:35 2015
@@ -5,8 +5,10 @@ import java.util.ConcurrentModificationE
 
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.cas.TOP;
 
-public abstract class FsIterator_singletype<T extends FeatureStructure>
+public abstract class FsIterator_singletype<T extends TOP>
                     implements LowLevelIterator<T>, 
                                Comparable<FsIterator_singletype<T>> {
 
@@ -26,9 +28,9 @@ public abstract class FsIterator_singlet
    * an instance of T and some other template type which can be a supertype of T, as long as
    * the keys are defined in both.
    */
-  final protected Comparator<FeatureStructure> comparator;
+  final protected Comparator<TOP> comparator;
 
-  public FsIterator_singletype(int[] detectConcurrentMods, int typeCode, Comparator<FeatureStructure> comparator){
+  public FsIterator_singletype(int[] detectConcurrentMods, int typeCode, Comparator<TOP> comparator){
     this.comparator = comparator;
     this.detectIllegalIndexUpdates = detectConcurrentMods;
     this.typeCode = typeCode;
@@ -57,4 +59,13 @@ public abstract class FsIterator_singlet
    
   @Override
   public abstract FsIterator_singletype<T> copy();
+  
+  @Override
+  public String toString() {
+    Type type = this.ll_getIndex().getType();
+    StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()).append(":").append(System.identityHashCode(this));
+    sb.append(" over Type: ").append(type.getName()).append(":").append(typeCode);
+    sb.append(", size: ").append(this.ll_indexSize());
+    return sb.toString();
+  }
 }

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes.java Mon Nov  9 19:36:35 2015
@@ -23,9 +23,11 @@ import java.util.NoSuchElementException;
 
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.jcas.cas.TOP;
 
 
-public abstract class FsIterator_subtypes<T extends FeatureStructure> implements LowLevelIterator<T> {
+public abstract class FsIterator_subtypes<T extends TOP> implements LowLevelIterator<T> {
 
   // The IICP
   final protected FsIndex_iicp<T> iicp;
@@ -69,4 +71,14 @@ public abstract class FsIterator_subtype
     @Override
     public FSIterator<FeatureStructure> copy() { return this; }
   };
+  
+  @Override
+  public String toString() {
+    TypeImpl type = (TypeImpl) this.ll_getIndex().getType();
+    StringBuilder sb = new StringBuilder(this.getClass().getSimpleName()).append(":").append(System.identityHashCode(this));
+    sb.append(" over Type: ").append(type.getName()).append(":").append(type.getCode());
+    sb.append(", size: ").append(this.ll_indexSize());
+    return sb.toString();
+  }
+  
 }

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_list.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_list.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_list.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_list.java Mon Nov  9 19:36:35 2015
@@ -21,12 +21,12 @@ package org.apache.uima.cas.impl;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Comparator;
 import java.util.function.Function;
 
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
 
-public abstract class FsIterator_subtypes_list <T extends FeatureStructure>  extends FsIterator_subtypes<T> {
+public abstract class FsIterator_subtypes_list <T extends TOP>  extends FsIterator_subtypes<T> {
 
   // An array of iterators, one for each subtype.
   //   This array has the indexes for all the subtypes that were non-empty at the time of iterator creation
@@ -49,10 +49,10 @@ public abstract class FsIterator_subtype
   //     subsequently ignored - same effect
   private FsIterator_singletype<T>[] initIterators() {
     iicp.createIndexIteratorCache();
-    final ArrayList<FsIndex_singletype<FeatureStructure>> cachedSubIndexes = iicp.cachedSubFsLeafIndexes;
+    final ArrayList<FsIndex_singletype<TOP>> cachedSubIndexes = iicp.cachedSubFsLeafIndexes;
     
     // map from single-type index to iterator over that single type
-    Function<FsIndex_singletype<FeatureStructure>, FsIterator_singletype<T>> m = 
+    Function<FsIndex_singletype<TOP>, FsIterator_singletype<T>> m = 
         fsIndex_singletype -> (FsIterator_singletype<T>)(fsIndex_singletype.iterator());
     
     FsIterator_singletype<T>[] r = cachedSubIndexes.stream()

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_ordered.java Mon Nov  9 19:36:35 2015
@@ -24,6 +24,7 @@ import java.util.NoSuchElementException;
 
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * Performs an ordered iteration among a set of iterators, each one corresponding to
@@ -35,7 +36,7 @@ import org.apache.uima.cas.FeatureStruct
  *
  * @param <T>
  */
-public class FsIterator_subtypes_ordered<T extends FeatureStructure> 
+public class FsIterator_subtypes_ordered<T extends TOP> 
                     extends FsIterator_subtypes_list<T> {
  
   /**
@@ -46,7 +47,7 @@ public class FsIterator_subtypes_ordered
   
   private boolean wentForward = true;
   
-  final private Comparator<FeatureStructure> comparator; 
+  final private Comparator<TOP> comparator; 
 
   public FsIterator_subtypes_ordered(FsIndex_iicp<T> iicp) {
     super(iicp);

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_snapshot.java Mon Nov  9 19:36:35 2015
@@ -26,8 +26,9 @@ import java.util.NoSuchElementException;
 import org.apache.uima.cas.FSIndex;
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
 
-public class FsIterator_subtypes_snapshot<T extends FeatureStructure> implements LowLevelIterator<T>, Comparator<T> {
+public class FsIterator_subtypes_snapshot<T extends TOP> implements LowLevelIterator<T>, Comparator<T> {
   
 //  final private FsIndex_flat<T> flatIndex;  // a newly created one, just for this iterator
   final private T[] snapshot;  // local for ref speed
@@ -161,7 +162,7 @@ public class FsIterator_subtypes_snapsho
     return indexForComparator;
   }
   
-  public int compare(FeatureStructure fs1, FeatureStructure fs2) {
+  public int compare(TOP fs1, TOP fs2) {
     return this.indexForComparator.compare(fs1, fs2);
   }
 }

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_unordered.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_unordered.java?rev=1713518&r1=1713517&r2=1713518&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_unordered.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FsIterator_subtypes_unordered.java Mon Nov  9 19:36:35 2015
@@ -23,13 +23,14 @@ import java.util.NoSuchElementException;
 
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
 
 /**
  * This class has an instance created temporarily to reuse the 
  * computation of the iterator array, for use by the FsIterator_aggregation_common.
  * @param <T> the type of the iterator
  */
-public class FsIterator_subtypes_unordered<T extends FeatureStructure> extends FsIterator_subtypes_list<T> {
+public class FsIterator_subtypes_unordered<T extends TOP> extends FsIterator_subtypes_list<T> {
  
   public FsIterator_subtypes_unordered(FsIndex_iicp<T> iicp) {
     super(iicp);