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/23 22:37:58 UTC

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

Author: schor
Date: Mon Nov 23 21:37:57 2015
New Revision: 1715968

URL: http://svn.apache.org/viewvc?rev=1715968&view=rev
Log:
[UIMA-4674] renaming of some classes for uniformity, getting journaling to work for delta cas, some reorg of code.

Added:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annot.java
      - copied, changed from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnot.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annotBase.java
      - copied, changed from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnotBase.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java
      - copied, changed from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplArray.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_javaObject.java
      - copied, changed from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplJavaObject.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_list.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_primitive.java
      - copied, changed from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplPrimitive.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java
      - copied, changed from r1713522, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplString.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_stringSubtype.java
      - copied, changed from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplStringSubtype.java
Removed:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnot.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnotBase.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplArray.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplJavaObject.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplPrimitive.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplString.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplStringSubtype.java
Modified:
    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/DeferredIndexUpdates.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.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/LLUnambiguousIteratorImpl.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java

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=1715968&r1=1715967&r2=1715968&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 23 21:37:57 2015
@@ -86,8 +86,12 @@ import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.cas.AnnotationBase;
 import org.apache.uima.jcas.cas.BooleanArray;
 import org.apache.uima.jcas.cas.ByteArray;
-import org.apache.uima.jcas.cas.CommonArray;
 import org.apache.uima.jcas.cas.DoubleArray;
+import org.apache.uima.jcas.cas.EmptyFSList;
+import org.apache.uima.jcas.cas.EmptyFloatList;
+import org.apache.uima.jcas.cas.EmptyIntegerList;
+import org.apache.uima.jcas.cas.EmptyList;
+import org.apache.uima.jcas.cas.EmptyStringList;
 import org.apache.uima.jcas.cas.FSArray;
 import org.apache.uima.jcas.cas.FloatArray;
 import org.apache.uima.jcas.cas.IntegerArray;
@@ -215,8 +219,8 @@ public class CASImpl extends AbstractCas
     FsChange(FeatureStructureImplC fs) {
       this.fs = fs;
       TypeImpl ti = fs._typeImpl;
-      intData = (ti.highestIntOffset == 0) ? null : new boolean[ti.highestIntOffset];
-      refData = (ti.highestRefOffset == 0) ? null : new boolean[ti.highestRefOffset];
+      intData = (ti.highestIntOffset == -1) ? null : new boolean[ti.highestIntOffset + 1];
+      refData = (ti.highestRefOffset == -1) ? null : new boolean[ti.highestRefOffset + 1];
       arrayUpdates = (ti.isArray()) ? new PositiveIntSet_impl() : null;
     }
     
@@ -355,6 +359,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();
     
+    // shared singltons, created at type system commit
+    
+    private EmptyFSList emptyFSList;
+    private EmptyFloatList emptyFloatList;
+    private EmptyIntegerList emptyIntegerList;
+    private EmptyStringList emptyStringList;
 //    private final BinaryCasSerDes bcsd;
     
     private SharedViewData(CASImpl baseCAS, TypeSystemImpl tsi) {
@@ -627,10 +637,13 @@ public class CASImpl extends AbstractCas
   }
   
   private <T extends FeatureStructureImplC> T createFSAnnotCheck(TypeImpl ti) {
-    if (ti.isAnnotationBaseType() && this.isBaseCas()) {    
+    if (ti.isAnnotationBaseType()) {
+      if (this.isBaseCas()) {    
         throw new CASRuntimeException(CASRuntimeException.DISALLOW_CREATE_ANNOTATION_IN_BASE_CAS, ti.getName());
+      }
+      getSofaRef();  // create sofa in _InitialView if needed
     }
-
+  
     T fs = (T) (((FsGenerator)getFsGenerator(ti.getCode())).createFS(ti, this));
     svd.cache_not_in_index = fs;
     return fs;
@@ -640,9 +653,11 @@ public class CASImpl extends AbstractCas
     return createFSAnnotCheck(getTypeSystemImpl().getTypeForCode(typeCode))._id;
   }
   
-  public CommonArray createArray(int typeCode, int arrayLength) {
-    return   (CommonArray)   (((FsGeneratorArray)getFsGenerator(typeCode))
-        .createFS(getTypeSystemImpl().getTypeForCode(typeCode), this, arrayLength));
+  public TOP createArray(TypeImpl type, int arrayLength) {
+    if (((TypeImpl_array)type).getComponentType().isPrimitive()) {
+      return (((FsGeneratorArray)getFsGenerator(type.getCode())).createFS(type, this, arrayLength));
+    }
+    return (TOP) createArrayFS(arrayLength);
   }
 
   public ArrayFS createArrayFS(int length) {
@@ -836,6 +851,8 @@ public class CASImpl extends AbstractCas
     }
     return this.mySofaRef;
   }
+  
+  
 
   // For internal use only
   public InputStream getSofaDataStream(SofaFS aSofa) {
@@ -1171,7 +1188,7 @@ public class CASImpl extends AbstractCas
     }
 
     // only create a new FsChange element if needed
-    if (change.fs != fs) {
+    if (change == null || change.fs != fs) {
       this.svd.modifiedPreexistingFSs.add(change = new FsChange(fs));
     }
           
@@ -1450,7 +1467,7 @@ public class CASImpl extends AbstractCas
       }
     }
     
-    if (range instanceof TypeImplString) {
+    if (range instanceof TypeImpl_string) {
       return fs.getStringValue(feat);
     }
     
@@ -1465,6 +1482,12 @@ public class CASImpl extends AbstractCas
     throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
   }
 
+  /**
+   * Supports setting slots to "0" for null values
+   * @param fs The feature structure to update
+   * @param feat the feature to update-
+   * @param s the string representation of the value, could be null
+   */
   public void setFeatureValueFromString(FeatureStructureImplC fs, FeatureImpl feat, String s) {
     final TypeImpl range = feat.getRangeImpl();
     if (fs instanceof Sofa) {
@@ -1481,23 +1504,27 @@ public class CASImpl extends AbstractCas
     
     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));
+      case TypeSystemImpl.floatTypeCode :   fs.setFloatValue(feat, (s == null) ? 0F : Float.parseFloat(s)); break;
+      case TypeSystemImpl.booleanTypeCode : fs.setBooleanValue(feat, (s == null) ? false : Boolean.parseBoolean(s)); break;
+      case TypeSystemImpl.longTypeCode :    fs.setLongValue(feat, (s == null) ? 0L : Long.parseLong(s)); break;
+      case TypeSystemImpl.doubleTypeCode :  fs.setDoubleValue(feat, (s == null) ? 0D : Double.parseDouble(s)); break;
+      case TypeSystemImpl.byteTypeCode :  fs.setByteValue(feat, (s == null) ? 0 : Byte.parseByte(s)); break;
+      case TypeSystemImpl.shortTypeCode :  fs.setShortValue(feat, (s == null) ? 0 : Short.parseShort(s)); break;
+      case TypeSystemImpl.intTypeCode :  fs.setIntValue(feat, (s == null) ? 0 : Integer.parseInt(s)); break;
+      default:                              fs.setIntValue(feat, (s == null) ? 0 : 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
+      if (s == null) {
+        fs.setFeatureValue(feat,  null);
+      } else {
+        // 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 TypeImpl_string) {  // includes TypeImplSubString
       // is String or Substring
-      fs.setStringValue(feat, s);
+      fs.setStringValue(feat, (s == null) ? null : s);
     } else if (range == tsi.javaObjectType) {
-      fs.setJavaObjectValue(feat, deserializeJavaObject(s));
+      fs.setJavaObjectValue(feat, (s == null) ? null : deserializeJavaObject(s));
     } else {
       throw new CASRuntimeException(CASRuntimeException.INTERNAL_ERROR);
     }
@@ -1533,7 +1560,7 @@ public class CASImpl extends AbstractCas
 
   // Type access methods.
   public boolean isStringType(Type type) {
-    return type instanceof TypeImplString;
+    return type instanceof TypeImpl_string;
   }
 
   public boolean isArrayOfFsType(Type type) {
@@ -1541,7 +1568,7 @@ public class CASImpl extends AbstractCas
   }
 
   public boolean isPrimitiveArrayType(Type type) {
-    return (type instanceof TypeImplArray) && ! type.getComponentType().isPrimitive();
+    return (type instanceof TypeImpl_array) && ! type.getComponentType().isPrimitive();
   }
 
   public boolean isIntArrayType(Type type) {
@@ -1981,32 +2008,7 @@ public class CASImpl extends AbstractCas
   }
 
   public final int ll_getTypeClass(int typeCode) {
-    final TypeSystemImpl ts = getTypeSystemImpl();
-    switch (typeCode) {
-    case TypeSystemImpl.intTypeCode: return TYPE_CLASS_INT;
-    case TypeSystemImpl.floatTypeCode: return TYPE_CLASS_FLOAT;
-    case TypeSystemImpl.stringTypeCode: return TYPE_CLASS_STRING;
-    case TypeSystemImpl.intArrayTypeCode: return TYPE_CLASS_INTARRAY;
-    case TypeSystemImpl.floatArrayTypeCode: return TYPE_CLASS_FLOATARRAY;
-    case TypeSystemImpl.stringArrayTypeCode: return TYPE_CLASS_STRINGARRAY;
-    case TypeSystemImpl.fsArrayTypeCode: return TYPE_CLASS_FSARRAY;
-    case TypeSystemImpl.booleanTypeCode: return TYPE_CLASS_BOOLEAN;
-    case TypeSystemImpl.byteTypeCode: return TYPE_CLASS_BYTE;
-    case TypeSystemImpl.shortTypeCode: return TYPE_CLASS_SHORT;
-    case TypeSystemImpl.longTypeCode: return TYPE_CLASS_LONG;
-    case TypeSystemImpl.doubleTypeCode: return TYPE_CLASS_DOUBLE;
-    case TypeSystemImpl.booleanArrayTypeCode: return TYPE_CLASS_BOOLEANARRAY;
-    case TypeSystemImpl.byteArrayTypeCode: return TYPE_CLASS_BYTEARRAY;
-    case TypeSystemImpl.shortArrayTypeCode: return TYPE_CLASS_SHORTARRAY;
-    case TypeSystemImpl.longArrayTypeCode: return TYPE_CLASS_LONGARRAY;
-    case TypeSystemImpl.doubleArrayTypeCode: return TYPE_CLASS_DOUBLEARRAY;
-    }
-        
-    if (ts.getTypeForCode(typeCode).isArray()) {
-      return TYPE_CLASS_FSARRAY;
-    }
-
-    return TYPE_CLASS_FS;
+    return TypeSystemImpl.getTypeClass(getTypeSystemImpl().getTypeForCode(typeCode));
   }
 
   // backwards compatibility only
@@ -2033,7 +2035,7 @@ public class CASImpl extends AbstractCas
    * @see org.apache.uima.cas.impl.LowLevelCAS#ll_createArray(int, int)
    */
   public int ll_createArray(int typeCode, int arrayLength) {
-    return createArray(typeCode, arrayLength).id();      
+    return createArray(getTypeSystemImpl().getTypeForCode_checked(typeCode), arrayLength).id();      
   }
 
   public int ll_createByteArray(int arrayLength) {
@@ -2214,6 +2216,10 @@ public class CASImpl extends AbstractCas
    * @return true if something may need to be added back
    */  
   private boolean checkForInvalidFeatureSetting(TOP fs, int featCode) {
+    return checkForInvalidFeatureSetting(fs, featCode, Integer.MIN_VALUE);
+  }
+    
+  private boolean checkForInvalidFeatureSetting(TOP fs, int featCode, int jcasFieldRegistryIndex) {
     if (fs == svd.cache_not_in_index) {
       return false;
     }
@@ -2224,8 +2230,14 @@ public class CASImpl extends AbstractCas
       return false;
     }
     
-    if (!svd.featureCodesInIndexKeys.get(featCode)) {
-      return false;
+    if (jcasFieldRegistryIndex == Integer.MIN_VALUE) {
+      if (!svd.featureCodesInIndexKeys.get(featCode)) {
+        return false;
+      }
+    } else {
+      if (!svd.featureJiInIndexKeys.get(jcasFieldRegistryIndex)) {
+        return false;
+      }
     }
 
     // next method skips if the fsRef is not in the index (cache)
@@ -2235,47 +2247,25 @@ public class CASImpl extends AbstractCas
                     svd.fsTobeAddedbackSingle 
         );            
  
-    svd.cache_not_in_index = fs; // speed up adds before add back
+    if (wasRemoved) {
+      // skip message if wasn't removed
+      // skip message if protected in explicit block
+      if (IS_REPORT_FS_UPDATE_CORRUPTS_INDEX && ssz == 0) {
+        if (jcasFieldRegistryIndex == Integer.MIN_VALUE) {
+          featModWhileInIndexReport(fs, featCode);
+        } else {
+          featModWhileInIndexReport(fs, getFeatFromJCasFieldRegistryIndex(jcasFieldRegistryIndex));
+        }
+      }
+      svd.cache_not_in_index = fs; // speed up adds before add back
+    }
     
-    // skip message if wasn't removed
-    // skip message if protected in explicit block
-    if (wasRemoved && IS_REPORT_FS_UPDATE_CORRUPTS_INDEX && ssz == 0) {
-      featModWhileInIndexReport(fs, featCode);
-    }  
     return wasRemoved;
   }
 
   // version of above, but using jcasFieldRegistryIndex
   private boolean checkForInvalidFeatureSettingJFRI(TOP fs, int jcasFieldRegistryIndex) {
-    if (fs == svd.cache_not_in_index) {
-      return false;
-    }
-    
-    final int ssz = svd.fssTobeAddedback.size();
-    // skip if protection is disabled, and no explicit protection block
-    if (IS_DISABLED_PROTECT_INDEXES && ssz == 0) {
-      return false;
-    }
-    
-    if (!svd.featureJiInIndexKeys.get(jcasFieldRegistryIndex)) {
-      return false;
-    }
-
-    // next method skips if the fsRef is not in the index (cache)
-    final boolean wasRemoved = removeFromCorruptableIndexAnyView(
-        fs, 
-        (ssz > 0) ? svd.fssTobeAddedback.get(ssz - 1) : 
-                    svd.fsTobeAddedbackSingle 
-        );            
- 
-    svd.cache_not_in_index = fs; // speed up adds before add back
-    
-    // skip message if wasn't removed
-    // skip message if protected in explicit block
-    if (wasRemoved && IS_REPORT_FS_UPDATE_CORRUPTS_INDEX && ssz == 0) {
-      featModWhileInIndexReport(fs, getFeatFromJCasFieldRegistryIndex(jcasFieldRegistryIndex));
-    }  
-    return wasRemoved;
+    return checkForInvalidFeatureSetting(fs, -1, jcasFieldRegistryIndex);
   }
   
   private FeatureImpl getFeatFromJCasFieldRegistryIndex(int jcasFieldRegistryIndex) {
@@ -2393,7 +2383,7 @@ public class CASImpl extends AbstractCas
       if (null == sofa) {
         return false;
       }
-      CAS view = (sofa == this.getSofaRef()) ? this : getViewFromSofaNbr(sofa.getSofaNum());
+      CAS view = (sofa == this.getSofa()) ? this : getViewFromSofaNbr(sofa.getSofaNum());
       if (null == view) {
         return false;
       }
@@ -2411,7 +2401,21 @@ public class CASImpl extends AbstractCas
     }
     return wasRemoved;
   }
-   
+
+  /**
+   * Called from XmiCasDeserialization for delta updating below the line
+   * @param fsRef
+   * @param toBeAdded
+   * @return
+   */
+  boolean removeFromCorruptableIndexAnyViewSetCache(final TOP fs, FSsTobeAddedback toBeAdded) {
+    if (fs != svd.cache_not_in_index) {
+      svd.cache_not_in_index = fs;
+      return removeFromCorruptableIndexAnyView(fs, toBeAdded);
+    }
+    return false;
+  }
+
   /**
    * remove a FS from corruptable indexes in this view
    * @param fs the fs to be removed
@@ -3209,17 +3213,17 @@ public class CASImpl extends AbstractCas
   // "end" feature to be the length of the sofa string
   /**
    * 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
+   * creates the document annotation if not present unless null = local string data
    * only works if not in the base cas
    * @return the document annotation
    */
-  public Annotation updateDocumentAnnotation() {
+  public void updateDocumentAnnotation() {
     if (!mySofaIsValid() || this == this.svd.baseCAS) {
-      return null;
+      return;
     }
     String newDoc = this.mySofaRef.getLocalStringData();
-    final Annotation docAnnot = getDocumentAnnotation();
     if (null != newDoc) {
+      Annotation docAnnot = getDocumentAnnotationNoCreate();
       if (docAnnot != null) {
         boolean wasRemoved = this.indexRepository.removeIfInCorrputableIndexInThisView(docAnnot);
         docAnnot.setIntValue(getTypeSystemImpl().endFeat, newDoc.length());
@@ -3228,10 +3232,10 @@ public class CASImpl extends AbstractCas
         }
       } else {
         // not in the index (yet)
-        return createDocumentAnnotation(newDoc.length());
+        createDocumentAnnotation(newDoc.length());
       }
     }
-    return docAnnot;
+    return;
   }
   
   /**
@@ -3240,6 +3244,15 @@ public class CASImpl extends AbstractCas
    *   annotations when JCas is not being used.
    */
   public <T extends Annotation> T getDocumentAnnotation() {
+    T docAnnot = getDocumentAnnotationNoCreate();
+    if (null == docAnnot) {
+      return (T) createDocumentAnnotationNoRemove(0);
+    } else {
+      return docAnnot;
+    }
+  }
+  
+  private <T extends Annotation> T getDocumentAnnotationNoCreate() {
     if (this == this.svd.baseCAS) {
       // base CAS has no document
       return null;
@@ -3248,7 +3261,7 @@ public class CASImpl extends AbstractCas
     if (it.isValid()) {
       return it.get();
     }
-    return (T) createDocumentAnnotationNoRemove(0);
+    return null;
   }
   
   /**
@@ -3424,7 +3437,7 @@ public class CASImpl extends AbstractCas
     
     Sofa sofa = fs.getSofa();
     
-    if (null != sofa && sofa != this.getSofaRef()) {
+    if (null != sofa && sofa != this.getSofa()) {
       return (CASImpl) this.getView(sofa.getSofaNum());
     }
     
@@ -3613,7 +3626,7 @@ public class CASImpl extends AbstractCas
     if (!this.svd.flushEnabled) {
 	  throw new CASAdminException(CASAdminException.FLUSH_DISABLED);
   	}
-  	this.svd.trackingMark = new MarkerImpl(this.getNextFsIdNoIncrement(), 
+  	this.svd.trackingMark = new MarkerImpl(this.getLastUsedFsId() + 1, 
   			this);
   	if (this.svd.modifiedPreexistingFSs == null) {
   	  this.svd.modifiedPreexistingFSs = new ArrayList<FsChange>();
@@ -3640,6 +3653,15 @@ public class CASImpl extends AbstractCas
 	return this.svd.modifiedPreexistingFSs;  
   }
   
+  FsChange getModifiedFSList(FeatureStructure fs) {
+    for (FsChange fsc : this.svd.modifiedPreexistingFSs) {
+      if (fsc.fs == fs) {
+        return fsc;
+      }
+    }
+    return null;
+  }
+  
   @Override
   public String toString() {
     String sofa =  (mySofaRef == null) ? (isBaseCas() ? "Base CAS" : "_InitialView or no Sofa") :
@@ -3657,9 +3679,9 @@ public class CASImpl extends AbstractCas
   }
   
   public int setId2fs(FeatureStructureImplC fs) {
-    if (svd.id2fs.size() == 3761) {
-      System.out.println("debug");
-    }
+//    if (svd.id2fs.size() == 3668) {
+//      System.out.println("debug setId2fs");
+//    }
     svd.id2fs.add(fs);
     if (svd.id2fs.size() != (2 + svd.fsIdGenerator.get())) {
       System.out.println("debug out of sync id generator and id2fs size");
@@ -3672,7 +3694,7 @@ public class CASImpl extends AbstractCas
     return svd.fsIdGenerator.incrementAndGet();
   }
   
-  public int getNextFsIdNoIncrement() {
+  public int getLastUsedFsId() {
     return svd.fsIdGenerator.get();
   }
     
@@ -3701,8 +3723,8 @@ public class CASImpl extends AbstractCas
     return ci1.getBaseCAS() == ci2.getBaseCAS();
   }
   
-  public boolean isInCAS(FeatureStructureImplC fs) {
-    return fs._casView.getBaseCAS() == this.getBaseCAS();
+  public boolean isInCAS(FeatureStructure fs) {
+    return ((TOP)fs)._casView.getBaseCAS() == this.getBaseCAS();
   }
   
   private Object getFsGenerator(int typecode) {
@@ -3716,4 +3738,65 @@ public class CASImpl extends AbstractCas
     }
   }
 
+  public EmptyFSList getEmptyFSList() {
+    if (null == svd.emptyFSList) {
+      svd.emptyFSList = new EmptyFSList(getTypeSystemImpl().fsEListType, this);
+    }
+    return svd.emptyFSList;
+  }
+
+  public EmptyFloatList getEmptyFloatList() {
+    if (null == svd.emptyFloatList) {
+      svd.emptyFloatList = new EmptyFloatList(getTypeSystemImpl().floatEListType, this);
+    }
+    return svd.emptyFloatList;
+  }
+  
+  public EmptyIntegerList getEmptyIntegerList() {
+    if (null == svd.emptyIntegerList) {
+      svd.emptyIntegerList = new EmptyIntegerList(getTypeSystemImpl().intEListType, this);
+    }
+    return svd.emptyIntegerList;
+  }
+  
+  public EmptyStringList getEmptyStringList() {
+    if (null == svd.emptyStringList) {
+      svd.emptyStringList = new EmptyStringList(getTypeSystemImpl().stringEListType, this);
+    }
+    return svd.emptyStringList;
+  }
+  
+  public EmptyList getEmptyList(int rangeCode) {
+    return (rangeCode == CasSerializerSupport.TYPE_CLASS_INTLIST) ? getEmptyIntegerList() :
+           (rangeCode == CasSerializerSupport.TYPE_CLASS_FLOATLIST) ? getEmptyFloatList() :
+           (rangeCode == CasSerializerSupport.TYPE_CLASS_STRINGLIST) ? getEmptyStringList() :
+                                                                       getEmptyFSList();
+  }
+    
+  /**
+   * Get an empty list from the type code of a list
+   * @param rangeCode
+   * @return
+   */
+  public EmptyList getEmptyListFromTypeCode(int rangeCode) {
+    switch (rangeCode) {
+    case TypeSystemImpl.fsListTypeCode:
+    case TypeSystemImpl.fsEListTypeCode:
+    case TypeSystemImpl.fsNeListTypeCode: return getEmptyFSList();
+    case TypeSystemImpl.floatListTypeCode:
+    case TypeSystemImpl.floatEListTypeCode:
+    case TypeSystemImpl.floatNeListTypeCode: return getEmptyFloatList();
+    case TypeSystemImpl.intListTypeCode:
+    case TypeSystemImpl.intEListTypeCode:
+    case TypeSystemImpl.intNeListTypeCode: return getEmptyIntegerList();
+    case TypeSystemImpl.stringListTypeCode:
+    case TypeSystemImpl.stringEListTypeCode:
+    case TypeSystemImpl.stringNeListTypeCode: return getEmptyStringList();
+    default: throw new IllegalArgumentException();
+    }
+  }
+
+  public TypeImpl getTypeImplFromJCasTypeIndex(int typeIndexID) {
+    return getTypeSystemImpl().getJCasRegisteredType(typeIndexID);
+  }
 }

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/DeferredIndexUpdates.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/DeferredIndexUpdates.java?rev=1715968&r1=1715967&r2=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/DeferredIndexUpdates.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/DeferredIndexUpdates.java Mon Nov 23 21:37:57 2015
@@ -18,10 +18,11 @@
  */
 package org.apache.uima.cas.impl;
 
+import java.util.ArrayList;
 import java.util.IdentityHashMap;
+import java.util.List;
 
-import org.apache.uima.internal.util.PositiveIntSet;
-import org.apache.uima.internal.util.PositiveIntSet_impl;
+import org.apache.uima.jcas.cas.TOP;
 
 
 
@@ -52,10 +53,10 @@ import org.apache.uima.internal.util.Pos
    */
   
 @SuppressWarnings("serial")  
-class DeferredIndexUpdates extends IdentityHashMap<FSIndexRepositoryImpl, PositiveIntSet> {
+class DeferredIndexUpdates extends IdentityHashMap<FSIndexRepositoryImpl, List<TOP>> {
     
-  void addTodo(FSIndexRepositoryImpl ir, int fsAddr) {
-    getTodos(ir).add(fsAddr);
+  void addTodo(FSIndexRepositoryImpl ir, TOP fs) {
+    getTodos(ir).add(fs);
   }
   
   /**
@@ -63,10 +64,10 @@ class DeferredIndexUpdates extends Ident
    * @param ir
    * @param fsAddr
    */
-  PositiveIntSet getTodos(FSIndexRepositoryImpl ir) {
-    PositiveIntSet s = get(ir);
+  List<TOP> getTodos(FSIndexRepositoryImpl ir) {
+    List<TOP> s = get(ir);
     if (null == s) {
-      put(ir, s = new PositiveIntSet_impl());
+      put(ir, s = new ArrayList<>());
     }
     return s;
   }

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java?rev=1715968&r1=1715967&r2=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FeatureImpl.java Mon Nov 23 21:37:57 2015
@@ -55,6 +55,8 @@ public class FeatureImpl implements Feat
   protected Object jcasSetter;  // null or the functional interface to call to set this feature
     
   private final SlotKind slotKind;
+  /** type class of the range, including CasSerializer List constants */
+  public  final int rangeTypeClass; // set from CasSerializerSupport.classifyType
     
 
   FeatureImpl(TypeImpl typeImpl, String shortName, TypeImpl rangeType, TypeSystemImpl tsi, boolean isMultipleRefsAllowed, SlotKind slotKind) {
@@ -68,6 +70,7 @@ public class FeatureImpl implements Feat
   this.shortName = shortName;
   this.isMultipleRefsAllowed = isMultipleRefsAllowed;
   this.isInInt = tsi.isInInt(rangeType);
+  this.rangeTypeClass = CasSerializerSupport.classifyType(rangeType);
   typeImpl.addFeature(this);  // might throw if existing feature with different range
   feats.add(this);
 }
@@ -105,7 +108,8 @@ public class FeatureImpl implements Feat
   }
 
   /**
-   * Get the name for this feature.
+   * Get the fully qualified name for this feature.
+   * The Feature qualifier is that of the highest defining type.
    * 
    * @return The name. This can not be <code>null</code>.
    */
@@ -215,7 +219,7 @@ public class FeatureImpl implements Feat
    * @param v the value to check
    */
   public void validateIsInAllowedValue(String v) {
-    TypeImplStringSubtype ti = (TypeImplStringSubtype) getRangeImpl();
+    TypeImpl_stringSubtype ti = (TypeImpl_stringSubtype) getRangeImpl();
     ti.validateIsInAllowedValues(v);
   }
 }

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=1715968&r1=1715967&r2=1715968&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 23 21:37:57 2015
@@ -232,6 +232,10 @@ public class FeatureStructureImplC imple
   public int _getTypeCode() {
     return _typeImpl.getCode();
   }
+  
+  public CASImpl _getView() {
+    return _casView;
+  }
 
   /* *********************************************************
    * Get and Set features indirectly, via Feature objects
@@ -422,7 +426,7 @@ public class FeatureStructureImplC imple
     TypeImpl range = (TypeImpl) feat.getRange();
     if (range.isStringSubtype()) {
       if (v != null) {
-        TypeImplStringSubtype tiSubtype = (TypeImplStringSubtype) range;
+        TypeImpl_stringSubtype tiSubtype = (TypeImpl_stringSubtype) range;
         tiSubtype.validateIsInAllowedValues(v);
       }
     } else if (range.getCode() != TypeSystemImpl.stringTypeCode) {
@@ -658,14 +662,14 @@ public class FeatureStructureImplC imple
         
     if (_typeImpl.isArray()) {
       CommonArray original = (CommonArray) this;
-      CommonArray copy = _casView.createArray(_typeImpl.getCode(), original.size());
+      CommonArray copy = (CommonArray) _casView.createArray(_typeImpl, original.size());
       copy.copyValuesFrom(original);      
       return (FeatureStructureImplC) copy;
     }
     
     FeatureStructureImplC fs = _casView.createFS(_typeImpl);
     
-    final int sofaFeatCode = TypeSystemImpl.annotSofaFeatCode;
+    final int sofaFeatCode = TypeSystemImpl.annotBaseSofaFeatCode;
 
     /* copy all the feature values except the sofa ref which is already set as part of creation */
     for (Feature feat : _typeImpl.getFeatures()) {
@@ -770,11 +774,13 @@ public class FeatureStructureImplC imple
     }
     
     final TypeImpl ti = this._typeImpl;
-    ti.getFeaturesAsStream()
-        .filter(fi -> fi.getRangeImpl().isRefType)     // is ref type
-        .map(fi -> this.getFeatureValue(fi)) // get the feature value
-        .filter(refFs -> refFs != null)            // skip null ones
-        .forEachOrdered(refFs -> getPrintRefs(printRefs, refFs));
+    if (ti != null) { // null for REMOVED marker
+      ti.getFeaturesAsStream()
+          .filter(fi -> fi.getRangeImpl().isRefType)     // is ref type
+          .map(fi -> this.getFeatureValue(fi)) // get the feature value
+          .filter(refFs -> refFs != null)            // skip null ones
+          .forEachOrdered(refFs -> getPrintRefs(printRefs, refFs));
+    }
   }
 
   @Override
@@ -805,7 +811,12 @@ public class FeatureStructureImplC imple
       boolean useShortNames, 
       String s, 
       PrintReferences printRefs) {
+    try {
     indent += incr;
+    if (indent > 20) {
+      buf.append(" ... past indent 20 ... ");
+      return;
+    }
     final int printInfo = printRefs.printInfo(this);
     if (printInfo != PrintReferences.NO_LABEL) {
       String label = printRefs.getLabel(this);
@@ -818,20 +829,26 @@ public class FeatureStructureImplC imple
       }
       buf.append(' ');
     }
-    if (useShortNames) {
-      buf.append(getType().getShortName());
+    if (_typeImpl == null) {
+      buf.append(" Special REMOVED marker ");
     } else {
-      buf.append(getType().getName());
-    }
-    buf.append(':').append(_id);
-    if (s != null) {
-      buf.append(" \"" + s + "\"");
+      if (useShortNames) {
+        buf.append(getType().getShortName());
+      } else {
+        buf.append(getType().getName());
+      }
+      buf.append(':').append(_id);
+      if (s != null) {
+        buf.append(" \"" + s + "\"");
+      }
     }
     buf.append('\n');
 
 //    final int typeClass = this._casView.ll_getTypeClass(this.getType());
     
-    
+    if (_typeImpl == null) {  // happens for special version which is REMOVED marker
+      return;
+    }
     switch (_getTypeCode()) {
     case TypeSystemImpl.stringArrayTypeCode: {
       StringArray a = (StringArray) this;
@@ -912,6 +929,12 @@ public class FeatureStructureImplC imple
         buf.append(this.getFeatureValueAsString(feat) + "\n");
       }
     }
+    } catch (Exception e) {
+      buf.append("**Caught exception: ").append(e);
+//      StringWriter sw = new StringWriter();
+//      e.printStackTrace(new PrintWriter(sw, true));
+//      buf.append(sw.toString());
+    }    
   }
 
   private void printArrayElements(int arrayLen, IntFunction<String> f, int indent, StringBuilder buf) {

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LLUnambiguousIteratorImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LLUnambiguousIteratorImpl.java?rev=1715968&r1=1715967&r2=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LLUnambiguousIteratorImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/LLUnambiguousIteratorImpl.java Mon Nov 23 21:37:57 2015
@@ -22,6 +22,7 @@ package org.apache.uima.cas.impl;
 import java.util.ArrayList;
 
 import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.jcas.cas.TOP;
 import org.apache.uima.jcas.tcas.Annotation;
 
 /**
@@ -31,7 +32,7 @@ import org.apache.uima.jcas.tcas.Annotat
  *
  * @param <T> the type this iterator is over (including subtypes)
  */
-public class LLUnambiguousIteratorImpl<T extends FeatureStructure> extends FsIterator_subtypes_snapshot<T> {
+public class LLUnambiguousIteratorImpl<T extends TOP> extends FsIterator_subtypes_snapshot<T> {
 
   public LLUnambiguousIteratorImpl(LowLevelIterator<FeatureStructure> it) {
     super((T[]) createItemsArray(it), it.ll_getIndex(), false);

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annot.java (from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnot.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annot.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annot.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnot.java&r1=1711784&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnot.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annot.java Mon Nov 23 21:37:57 2015
@@ -23,9 +23,9 @@ package org.apache.uima.cas.impl;
  * A version of TypeImpl for Annotations and subtypes of Annotations
  *
  */
-public class TypeImplAnnot extends TypeImplAnnotBase {
+public class TypeImpl_annot extends TypeImpl_annotBase {
     
-  public TypeImplAnnot(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
+  public TypeImpl_annot(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
     super(name, tsi, supertype, javaClass);
   }
   

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annotBase.java (from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnotBase.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annotBase.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annotBase.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnotBase.java&r1=1711784&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplAnnotBase.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_annotBase.java Mon Nov 23 21:37:57 2015
@@ -23,9 +23,9 @@ package org.apache.uima.cas.impl;
  * A version of TypeImpl for the AnnotationBase type and its subtypes
  */
 
-public class TypeImplAnnotBase extends TypeImpl {
+public class TypeImpl_annotBase extends TypeImpl {
   
-  public TypeImplAnnotBase(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
+  public TypeImpl_annotBase(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
     super(name, tsi, supertype, javaClass);
   }
   

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java (from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplArray.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplArray.java&r1=1711784&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplArray.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_array.java Mon Nov 23 21:37:57 2015
@@ -22,7 +22,7 @@ package org.apache.uima.cas.impl;
 import org.apache.uima.cas.Type;
 import org.apache.uima.cas.impl.SlotKinds.SlotKind;
 
-public class TypeImplArray extends TypeImpl {
+public class TypeImpl_array extends TypeImpl {
   
   private final TypeImpl componentType;
   
@@ -30,7 +30,7 @@ public class TypeImplArray extends TypeI
   
   private final SlotKind slotKind;
   
-  public TypeImplArray(String name, TypeImpl componentType, TypeSystemImpl tsi, TypeImpl supertype, 
+  public TypeImpl_array(String name, TypeImpl componentType, TypeSystemImpl tsi, TypeImpl supertype, 
       SlotKind slotKind, boolean isHeapStoredArray, Class<?> javaClass) {
     super(name, tsi, supertype, javaClass);
     this.isInheritanceFinal = true;
@@ -45,7 +45,7 @@ public class TypeImplArray extends TypeI
   }
   
   TypeImpl consolidateType(TypeImpl topType, TypeImpl fsArrayType) {
-    if (!(componentType instanceof TypeImplPrimitive)) {
+    if (!(componentType instanceof TypeImpl_primitive)) {
         return fsArrayType;  // booleanArrayType, stringArrayType etc.
     }
     // is a primitive array

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_javaObject.java (from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplJavaObject.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_javaObject.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_javaObject.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplJavaObject.java&r1=1711784&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplJavaObject.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_javaObject.java Mon Nov 23 21:37:57 2015
@@ -25,9 +25,9 @@ package org.apache.uima.cas.impl;
  * values of Feature slots.
  *
  */
-public class TypeImplJavaObject extends TypeImplPrimitive {
+public class TypeImpl_javaObject extends TypeImpl_primitive {
   
-  public TypeImplJavaObject(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
+  public TypeImpl_javaObject(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
     super(name, tsi, supertype, javaClass);
   }
   

Added: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_list.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_list.java?rev=1715968&view=auto
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_list.java (added)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_list.java Mon Nov 23 21:37:57 2015
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.cas.impl;
+
+import org.apache.uima.cas.Type;
+
+public class TypeImpl_list extends TypeImpl {
+  
+  TypeImpl componentType;
+      
+  public TypeImpl_list(String name, TypeImpl componentType, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaClass) {
+    super(name, tsi, supertype, javaClass);
+    this.componentType = componentType;
+    }
+  
+  public Type getCompoentType() {
+    return componentType;
+  }    
+  
+}

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_primitive.java (from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplPrimitive.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_primitive.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_primitive.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplPrimitive.java&r1=1711784&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplPrimitive.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_primitive.java Mon Nov 23 21:37:57 2015
@@ -21,9 +21,9 @@ package org.apache.uima.cas.impl;
 
 import java.util.List;
 
-public class TypeImplPrimitive extends TypeImpl {
+public class TypeImpl_primitive extends TypeImpl {
 
-  public TypeImplPrimitive(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaType) {
+  public TypeImpl_primitive(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaType) {
     super(name, tsi, supertype, javaType);
   }
   

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java (from r1713522, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplString.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplString.java&r1=1713522&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplString.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_string.java Mon Nov 23 21:37:57 2015
@@ -19,13 +19,13 @@
 
 package org.apache.uima.cas.impl;
 
-public class TypeImplString extends TypeImplPrimitive {  // string considered a primitive e.g. in index comparators
+public class TypeImpl_string extends TypeImpl_primitive {  // string considered a primitive e.g. in index comparators
   
-  public TypeImplString(String name, TypeSystemImpl tsi, TypeImpl supertype) {
+  public TypeImpl_string(String name, TypeSystemImpl tsi, TypeImpl supertype) {
     super(name, tsi, supertype, String.class);
   }
   
-  public TypeImplString(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaType) {
+  public TypeImpl_string(String name, TypeSystemImpl tsi, TypeImpl supertype, Class<?> javaType) {
     super(name, tsi, supertype, javaType);
   }
   

Copied: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_stringSubtype.java (from r1711784, uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplStringSubtype.java)
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_stringSubtype.java?p2=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_stringSubtype.java&p1=uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplStringSubtype.java&r1=1711784&r2=1715968&rev=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImplStringSubtype.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeImpl_stringSubtype.java Mon Nov 23 21:37:57 2015
@@ -26,11 +26,11 @@ import java.util.Set;
 
 import org.apache.uima.cas.CASRuntimeException;
 
-public class TypeImplStringSubtype extends TypeImplString {  // string considered a primitive e.g. in index comparators
+public class TypeImpl_stringSubtype extends TypeImpl_string {  // string considered a primitive e.g. in index comparators
   
   private final Set<String> allowedValues;
 
-  public TypeImplStringSubtype(String name, TypeSystemImpl tsi, TypeImpl supertype, Set<String> allowedValues) {
+  public TypeImpl_stringSubtype(String name, TypeSystemImpl tsi, TypeImpl supertype, Set<String> allowedValues) {
     super(name, tsi, supertype);
     this.allowedValues = Collections.unmodifiableSet(allowedValues);
   }

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java?rev=1715968&r1=1715967&r2=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystem2Xml.java Mon Nov 23 21:37:57 2015
@@ -157,7 +157,7 @@ public class TypeSystem2Xml {
       typeDesc.setFeatures(featDescArr);
 
       // check for string subtypes
-      if (type instanceof TypeImplString) {
+      if (type instanceof TypeImpl_string) {
         LowLevelTypeSystem lts = aTypeSystem.getLowLevelTypeSystem();
         final int typeCode = lts.ll_getCodeForType(type);
         String[] strings = lts.ll_getStringSet(typeCode);

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1715968&r1=1715967&r2=1715968&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Mon Nov 23 21:37:57 2015
@@ -71,6 +71,7 @@ import org.apache.uima.jcas.cas.DoubleAr
 import org.apache.uima.jcas.cas.EmptyFSList;
 import org.apache.uima.jcas.cas.EmptyFloatList;
 import org.apache.uima.jcas.cas.EmptyIntegerList;
+import org.apache.uima.jcas.cas.EmptyList;
 import org.apache.uima.jcas.cas.EmptyStringList;
 import org.apache.uima.jcas.cas.FSArray;
 import org.apache.uima.jcas.cas.FSList;
@@ -168,18 +169,18 @@ public class TypeSystemImpl implements T
   public static final int intArrayTypeCode = 8;
   public static final int stringArrayTypeCode = 9;
   // 10 list base
-  // 11           fs list
-  // 12 empty     fs list
-  // 13 non-empty fs list
-  // 14           float list
-  // 15 empty     float list
-  // 16 non-empty float list
-  // 17           integer list
-  // 18 empty     integer list
-  // 19 non-empty integer list
-  // 20           string list
-  // 21 empty     string list
-  // 22 non-empty string list
+  public static final int fsListTypeCode = 11; // 11           fs list
+  public static final int fsEListTypeCode = 12;// 12 empty     fs list
+  public static final int fsNeListTypeCode = 13;// 13 non-empty fs list
+  public static final int floatListTypeCode = 14; // 14           float list
+  public static final int floatEListTypeCode = 15;// 15 empty     float list
+  public static final int floatNeListTypeCode = 16;  // 16 non-empty float list
+  public static final int intListTypeCode = 17; // 17           integer list
+  public static final int intEListTypeCode = 18;  // 18 empty     integer list
+  public static final int intNeListTypeCode = 19; // 19 non-empty integer list
+  public static final int stringListTypeCode = 20;  // 20           string list
+  public static final int stringEListTypeCode = 21;  // 21 empty     string list
+  public static final int stringNeListTypeCode = 22;  // 22 non-empty string list
 
   public static final int booleanTypeCode = 23;
   public static final int byteTypeCode = 24;
@@ -194,7 +195,7 @@ public class TypeSystemImpl implements T
   public static final int sofaTypeCode = 33;
   public static final int annotBaseTypeCode = 34;
   public static final int annotTypeCode = 35;
-  public static final int docTypeCode = 36;  
+  public static final int docTypeCode = 36;  // DocumentAnnotation
   public static final int javaObjectTypeCode = 37;
   public static final int javaObjectArrayTypeCode = 38;
     
@@ -245,7 +246,7 @@ public class TypeSystemImpl implements T
          static final int sofaMimeFeatCode = 11;
          static final int sofaUriFeatCode = 14;
          static final int sofaArrayFeatCode = 12;
-  public static final int annotSofaFeatCode = 15; // ref from another pkg
+  public static final int annotBaseSofaFeatCode = 15; // ref from another pkg
   public static final int beginFeatCode = 16;
   public static final int endFeatCode = 17;
          static final int langFeatCode = 18;
@@ -280,10 +281,7 @@ public class TypeSystemImpl implements T
            CAS.TYPE_NAME_DOCUMENT_ANNOTATION,
            CAS.TYPE_NAME_JAVA_OBJECT_ARRAY);
   }
-         
-         
-  public static final TypeSystemImpl staticTsi = new TypeSystemImpl();
-    
+             
   /******************************************
    *   I N S T A N C E   V A R I A B L E S  *
    ******************************************/
@@ -305,41 +303,41 @@ public class TypeSystemImpl implements T
   public final TypeImpl      stringType;
   public final TypeImpl      floatType;
          final TypeImpl      arrayBaseType;
-         final TypeImplArray intArrayType;
-         final TypeImplArray floatArrayType;
-         final TypeImplArray stringArrayType;
-         final TypeImplArray fsArrayType;
-         final TypeImplArray topArrayType;  // same as fsArrayType
+         final TypeImpl_array intArrayType;
+         final TypeImpl_array floatArrayType;
+         final TypeImpl_array stringArrayType;
+         final TypeImpl_array fsArrayType;
+         final TypeImpl_array topArrayType;  // same as fsArrayType
   public final TypeImpl      sofaType;   // public needed for CasCopier
   public final TypeImpl      annotType;
   public final TypeImpl      annotBaseType;
   public final TypeImpl      docType;
   public final TypeImpl      byteType;
-         final TypeImplArray byteArrayType;
+         final TypeImpl_array byteArrayType;
   public final TypeImpl      booleanType;
-         final TypeImplArray booleanArrayType;
+         final TypeImpl_array booleanArrayType;
   public final TypeImpl      shortType;
-         final TypeImplArray shortArrayType;
+         final TypeImpl_array shortArrayType;
   public final TypeImpl      longType;
-         final TypeImplArray longArrayType;
+         final TypeImpl_array longArrayType;
   public final TypeImpl      doubleType;
-         final TypeImplArray doubleArrayType;
+         final TypeImpl_array doubleArrayType;
          
-         final TypeImplJavaObject javaObjectType;   // for Map, List, etc.
-         final TypeImplArray javaObjectArrayType;   // for arrays of these
+         final TypeImpl_javaObject javaObjectType;   // for Map, List, etc.
+         final TypeImpl_array javaObjectArrayType;   // for arrays of these
          final TypeImpl listBaseType;
-         final TypeImpl intListType;
-         final TypeImpl floatListType;
-         final TypeImpl stringListType;
-         final TypeImpl fsListType;
-         final TypeImpl intEListType;
-         final TypeImpl floatEListType;
-         final TypeImpl stringEListType;
-         final TypeImpl fsEListType;
-         final TypeImpl intNeListType;
-         final TypeImpl floatNeListType;
-         final TypeImpl stringNeListType;
-         final TypeImpl fsNeListType;          
+  public final TypeImpl_list intListType;
+  public final TypeImpl_list floatListType;
+  public final TypeImpl_list stringListType;
+  public final TypeImpl_list fsListType;
+  public final TypeImpl_list intEListType;
+  public final TypeImpl_list floatEListType;
+  public final TypeImpl_list stringEListType;
+  public final TypeImpl_list fsEListType;
+  public final TypeImpl_list intNeListType;
+  public final TypeImpl_list floatNeListType;
+  public final TypeImpl_list stringNeListType;
+  public final TypeImpl_list fsNeListType;          
           
 //  /**
 //   * List indexed by typecode
@@ -446,9 +444,9 @@ public class TypeSystemImpl implements T
     topType = new TypeImpl(CAS.TYPE_NAME_TOP, this, null, TOP.class);   
 
     // Add basic data types.
-    intType = new TypeImplPrimitive(CAS.TYPE_NAME_INTEGER, this, topType, int.class);
-    floatType = new TypeImplPrimitive(CAS.TYPE_NAME_FLOAT, this, topType, float.class);
-    stringType = new TypeImplString(CAS.TYPE_NAME_STRING, this, topType, String.class);
+    intType = new TypeImpl_primitive(CAS.TYPE_NAME_INTEGER, this, topType, int.class);
+    floatType = new TypeImpl_primitive(CAS.TYPE_NAME_FLOAT, this, topType, float.class);
+    stringType = new TypeImpl_string(CAS.TYPE_NAME_STRING, this, topType, String.class);
     
     // Add arrays.
     arrayBaseType = new TypeImpl(CAS.TYPE_NAME_ARRAY_BASE, this, topType);
@@ -461,38 +459,38 @@ public class TypeSystemImpl implements T
     listBaseType = new TypeImpl(CAS.TYPE_NAME_LIST_BASE, this, topType);
     
     // FS list
-    fsListType = new TypeImpl(CAS.TYPE_NAME_FS_LIST, this, listBaseType, FSList.class);
-    fsEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_FS_LIST, this, fsListType, EmptyFSList.class);
-    fsNeListType = new TypeImpl(CAS.TYPE_NAME_NON_EMPTY_FS_LIST, this, fsListType, NonEmptyFSList.class);
+    fsListType = new TypeImpl_list(CAS.TYPE_NAME_FS_LIST, topType, this, listBaseType, FSList.class);
+    fsEListType = new TypeImpl_list(CAS.TYPE_NAME_EMPTY_FS_LIST, topType, this, fsListType, EmptyFSList.class);
+    fsNeListType = new TypeImpl_list(CAS.TYPE_NAME_NON_EMPTY_FS_LIST, topType, this, fsListType, NonEmptyFSList.class);
     addFeature(CAS.FEATURE_BASE_NAME_HEAD, fsNeListType, topType, true);
     addFeature(CAS.FEATURE_BASE_NAME_TAIL, fsNeListType, fsListType, true);
     
     // Float list
-    floatListType = new TypeImpl(CAS.TYPE_NAME_FLOAT_LIST, this, listBaseType, FloatList.class);
-    floatEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_FLOAT_LIST, this, floatListType, EmptyFloatList.class);
-    floatNeListType = new TypeImpl(CAS.TYPE_NAME_NON_EMPTY_FLOAT_LIST, this, floatListType, NonEmptyFloatList.class);
+    floatListType = new TypeImpl_list(CAS.TYPE_NAME_FLOAT_LIST, floatType, this, listBaseType, FloatList.class);
+    floatEListType = new TypeImpl_list(CAS.TYPE_NAME_EMPTY_FLOAT_LIST, floatType, this, floatListType, EmptyFloatList.class);
+    floatNeListType = new TypeImpl_list(CAS.TYPE_NAME_NON_EMPTY_FLOAT_LIST, floatType, this, floatListType, NonEmptyFloatList.class);
     addFeature(CAS.FEATURE_BASE_NAME_HEAD, floatNeListType, floatType, false);
     addFeature(CAS.FEATURE_BASE_NAME_TAIL, floatNeListType, floatListType, true);
     
     // Integer list
-    intListType = new TypeImpl(CAS.TYPE_NAME_INTEGER_LIST, this, listBaseType, IntegerList.class);
-    intEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_INTEGER_LIST, this, intListType, EmptyIntegerList.class);
-    intNeListType = new TypeImpl(CAS.TYPE_NAME_NON_EMPTY_INTEGER_LIST, this, intListType, NonEmptyIntegerList.class);
+    intListType = new TypeImpl_list(CAS.TYPE_NAME_INTEGER_LIST, intType, this, listBaseType, IntegerList.class);
+    intEListType = new TypeImpl_list(CAS.TYPE_NAME_EMPTY_INTEGER_LIST, intType, this, intListType, EmptyIntegerList.class);
+    intNeListType = new TypeImpl_list(CAS.TYPE_NAME_NON_EMPTY_INTEGER_LIST, intType, this, intListType, NonEmptyIntegerList.class);
     addFeature(CAS.FEATURE_BASE_NAME_HEAD, intNeListType, intType, false);
     addFeature(CAS.FEATURE_BASE_NAME_TAIL, intNeListType, intListType, true);
     
     // String list
-    stringListType = new TypeImpl(CAS.TYPE_NAME_STRING_LIST, this, listBaseType, StringList.class);
-    stringEListType = new TypeImpl(CAS.TYPE_NAME_EMPTY_STRING_LIST, this, stringListType, EmptyStringList.class);
-    stringNeListType = new TypeImpl(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST, this, stringListType, NonEmptyStringList.class);
+    stringListType = new TypeImpl_list(CAS.TYPE_NAME_STRING_LIST, stringType, this, listBaseType, StringList.class);
+    stringEListType = new TypeImpl_list(CAS.TYPE_NAME_EMPTY_STRING_LIST, stringType, this, stringListType, EmptyStringList.class);
+    stringNeListType = new TypeImpl_list(CAS.TYPE_NAME_NON_EMPTY_STRING_LIST, stringType, this, stringListType, NonEmptyStringList.class);
     addFeature(CAS.FEATURE_BASE_NAME_HEAD, stringNeListType, stringType, false);
     addFeature(CAS.FEATURE_BASE_NAME_TAIL, stringNeListType, stringListType, true);
-
-    booleanType = new TypeImplPrimitive(CAS.TYPE_NAME_BOOLEAN, this, topType, boolean.class);    
-    byteType = new TypeImplPrimitive(CAS.TYPE_NAME_BYTE, this, topType, byte.class);
-    shortType = new TypeImplPrimitive(CAS.TYPE_NAME_SHORT, this, topType, short.class);
-    longType = new TypeImplPrimitive(CAS.TYPE_NAME_LONG, this, topType, long.class);
-    doubleType = new TypeImplPrimitive(CAS.TYPE_NAME_DOUBLE, this, topType, double.class);
+    
+    booleanType = new TypeImpl_primitive(CAS.TYPE_NAME_BOOLEAN, this, topType, boolean.class);    
+    byteType = new TypeImpl_primitive(CAS.TYPE_NAME_BYTE, this, topType, byte.class);
+    shortType = new TypeImpl_primitive(CAS.TYPE_NAME_SHORT, this, topType, short.class);
+    longType = new TypeImpl_primitive(CAS.TYPE_NAME_LONG, this, topType, long.class);
+    doubleType = new TypeImpl_primitive(CAS.TYPE_NAME_DOUBLE, this, topType, double.class);
 
     // array type initialization must follow the component type it's based on
     booleanArrayType = addArrayType(booleanType, Slot_BooleanRef, !HEAP_STORED_ARRAY, BooleanArray.class);  // yes, byteref
@@ -513,17 +511,17 @@ public class TypeSystemImpl implements T
     sofaUri = (FeatureImpl) addFeature(CAS.FEATURE_BASE_NAME_SOFAURI, sofaType, stringType, false);
 
     // Annotations
-    annotBaseType = new TypeImplAnnotBase(CAS.TYPE_NAME_ANNOTATION_BASE, this, topType, AnnotationBase.class);
+    annotBaseType = new TypeImpl_annotBase(CAS.TYPE_NAME_ANNOTATION_BASE, this, topType, AnnotationBase.class);
     addFeature(CAS.FEATURE_BASE_NAME_SOFA, annotBaseType, sofaType, false);
     
-    annotType = new TypeImplAnnot(CAS.TYPE_NAME_ANNOTATION, this, annotBaseType, Annotation.class);
+    annotType = new TypeImpl_annot(CAS.TYPE_NAME_ANNOTATION, this, annotBaseType, Annotation.class);
     startFeat = (FeatureImpl) addFeature(CAS.FEATURE_BASE_NAME_BEGIN, annotType, intType, false);
     endFeat = (FeatureImpl) addFeature(CAS.FEATURE_BASE_NAME_END, annotType, intType, false);
     
-    docType = new TypeImplAnnot(CAS.TYPE_NAME_DOCUMENT_ANNOTATION, this, annotType, Annotation.class);
+    docType = new TypeImpl_annot(CAS.TYPE_NAME_DOCUMENT_ANNOTATION, this, annotType, Annotation.class);
     langFeat = (FeatureImpl) addFeature(CAS.FEATURE_BASE_NAME_LANGUAGE, docType, stringType, false);
     
-    javaObjectType = new TypeImplJavaObject(CAS.TYPE_NAME_JAVA_OBJECT, this, topType, Object.class);
+    javaObjectType = new TypeImpl_javaObject(CAS.TYPE_NAME_JAVA_OBJECT, this, topType, Object.class);
     javaObjectArrayType = addArrayType(javaObjectType, null, HEAP_STORED_ARRAY, JavaObjectArray.class);
     
     arrayName2ComponentType.put(CAS.TYPE_NAME_FS_ARRAY, topType);
@@ -604,6 +602,20 @@ public class TypeSystemImpl implements T
     setTypeFinal(longArrayType);
     setTypeFinal(doubleArrayType);
     setTypeFinal(javaObjectArrayType);
+    
+    setTypeFinal(fsListType);
+    setTypeFinal(floatListType);
+    setTypeFinal(stringListType);
+    setTypeFinal(intListType);
+    setTypeFinal(fsEListType);
+    setTypeFinal(floatEListType);
+    setTypeFinal(stringEListType);
+    setTypeFinal(intEListType);
+    setTypeFinal(fsNeListType);
+    setTypeFinal(floatNeListType);
+    setTypeFinal(stringNeListType);
+    setTypeFinal(intNeListType);
+    
 
     listBaseType.setFeatureFinal();
     fsListType.setFeatureFinal();
@@ -840,9 +852,9 @@ public class TypeSystemImpl implements T
             
     final TypeImpl supertypeimpl = (TypeImpl) superType;
     TypeImpl ti = supertypeimpl.isAnnotationType() ? 
-                    new TypeImplAnnot    (typeName, this, supertypeimpl, Annotation.class) :
+                    new TypeImpl_annot    (typeName, this, supertypeimpl, Annotation.class) :
                   supertypeimpl.isAnnotationBaseType() ?
-                    new TypeImplAnnotBase(typeName, this, supertypeimpl, AnnotationBase.class) :
+                    new TypeImpl_annotBase(typeName, this, supertypeimpl, AnnotationBase.class) :
                     new TypeImpl         (typeName, this, supertypeimpl);         
     return ti;
   }
@@ -1080,8 +1092,8 @@ public class TypeSystemImpl implements T
       if (isSubArray) {
         // If both types are arrays, simply compare the components.
         return subsumes(
-            ((TypeImplArray)superType).getComponentType(), 
-            ((TypeImplArray)subType  ).getComponentType());
+            ((TypeImpl_array)superType).getComponentType(), 
+            ((TypeImpl_array)subType  ).getComponentType());
       }
       // An array can never subsume a non-array.
       return false;
@@ -1319,6 +1331,7 @@ public class TypeSystemImpl implements T
     fsClassRegistry = new FSClassRegistry(this, true);
     
     computeAdjustedFeatureOffsets(topType, 0, 0);
+    
   }
   
   /**
@@ -1329,17 +1342,15 @@ public class TypeSystemImpl implements T
    * @param nextR - the next available slot to use - for ref style items
    */
   private void computeAdjustedFeatureOffsets(TypeImpl ti, int nextI, int nextR) {
-    int iFeat = nextI;
-    int rFeat = nextR;
     
     Class<?>clazz = getFSClassRegistry().getJCasClass(ti.getCode());
     
     for (final FeatureImpl fi : ti.getMergedStaticFeaturesIntroducedByThisType()) {
       if ( ! FSClassRegistry.isFieldInClass(fi, clazz)) {
 
-        fi.setAdjustedOffset(fi.isInInt ? (iFeat ++) : (rFeat ++));
+        fi.setAdjustedOffset(fi.isInInt ? (nextI ++) : (nextR ++));
         if (((TypeImpl)fi.getRange()).isLongOrDouble) {
-          iFeat ++;
+          nextI ++;
         }        
       } else { // field is in the JCas cover object
         GetterSetter gs = fsClassRegistry.getGetterSetter(ti.getCode(), fi.getShortName());
@@ -1348,11 +1359,11 @@ public class TypeSystemImpl implements T
       }
     }
     
-    ti.nbrOfUsedIntDataSlots = iFeat;
-    ti.nbrOfUsedRefDataSlots = rFeat;
+    ti.nbrOfUsedIntDataSlots = nextI;
+    ti.nbrOfUsedRefDataSlots = nextR;
     
     for (TypeImpl sub : ti.getDirectSubtypes()) {
-      computeAdjustedFeatureOffsets(sub, iFeat, rFeat);
+      computeAdjustedFeatureOffsets(sub, nextI, nextR);
     }  
   }
     
@@ -1363,21 +1374,22 @@ public class TypeSystemImpl implements T
    * @param nextR - the next available ref offset
    */
   private void computeFeatureOffsets(TypeImpl ti, int nextI, int nextR) {
-    int iFeat = nextI;
-    int rFeat = nextR;
     
+    if (ti.getCode() == docTypeCode) {
+      System.out.println("debug");
+    }
     for (FeatureImpl fi : ti.getMergedStaticFeaturesIntroducedByThisType()) {
-      fi.setOffset(fi.isInInt ? (iFeat ++) : (rFeat ++));
+      fi.setOffset(fi.isInInt ? (nextI ++) : (nextR ++));
       if (((TypeImpl)fi.getRange()).isLongOrDouble) {
-        iFeat ++;
+        nextI ++;
       }
     }
         
-    ti.highestIntOffset = nextI;
-    ti.highestRefOffset = nextR;
+    ti.highestIntOffset = nextI - 1;  // highest index value, 0 based index
+    ti.highestRefOffset = nextR - 1;
     
     for (TypeImpl sub : ti.getDirectSubtypes()) {
-      computeFeatureOffsets(sub, iFeat, rFeat);
+      computeFeatureOffsets(sub, nextI, nextR);
     }  
   }
 
@@ -1500,11 +1512,11 @@ public class TypeSystemImpl implements T
 
     TypeImpl existingTi = getType(typeName);
     if (existingTi != null) {
-      if (!(existingTi instanceof TypeImplStringSubtype)) {
+      if (!(existingTi instanceof TypeImpl_stringSubtype)) {
         throw new CASAdminException(CASAdminException.STRING_SUBTYPE_REDEFINE_NAME_CONFLICT,
             typeName, existingTi.toString());
       }
-      Set<String> existingAllowedValues = ((TypeImplStringSubtype) existingTi).getAllowedValues();
+      Set<String> existingAllowedValues = ((TypeImpl_stringSubtype) existingTi).getAllowedValues();
       if (!existingAllowedValues.equals(allowedValues)) {
         // this type is already defined with identical allowed values, return
         // existing one
@@ -1517,7 +1529,7 @@ public class TypeSystemImpl implements T
     }
 
     // Create the type.
-    TypeImplStringSubtype type = new TypeImplStringSubtype(typeName, this, supertype, allowedValues);
+    TypeImpl_stringSubtype type = new TypeImpl_stringSubtype(typeName, this, supertype, allowedValues);
     type.setFeatureFinal();
     type.setInheritanceFinal();
     return type;
@@ -1529,11 +1541,11 @@ public class TypeSystemImpl implements T
    * @param componentType the component type
    * @return a TypeImplArray 
    */
-  TypeImplArray addArrayType(Type componentType, SlotKind slotKind, boolean isHeapStoredArray, Class<?> javaClass) {
+  TypeImpl_array addArrayType(Type componentType, SlotKind slotKind, boolean isHeapStoredArray, Class<?> javaClass) {
     String arrayTypeName = getArrayTypeName(componentType.getName());
     // either fsArray or TOP
     TypeImpl supertype = computeArrayParentFromComponentType(componentType); 
-    TypeImplArray ti = new TypeImplArray(arrayTypeName, (TypeImpl) componentType, this, supertype, slotKind, isHeapStoredArray, javaClass);
+    TypeImpl_array ti = new TypeImpl_array(arrayTypeName, (TypeImpl) componentType, this, supertype, slotKind, isHeapStoredArray, javaClass);
     this.arrayComponentTypeToArrayType.put(componentType, ti);
     // the reverse - going from array type to component type is done via the getComponentType method of TypeImplArray
     return ti;
@@ -1660,7 +1672,7 @@ public class TypeSystemImpl implements T
           i++;
           TypeImpl slotType = (TypeImpl) feat.getRange();
 
-          if (slotType == stringType || (slotType instanceof TypeImplString)) {
+          if (slotType == stringType || (slotType instanceof TypeImpl_string)) {
             slots.add(Slot_StrRef);
             strRefsTemp.add(i + 1);  // first feature is offset 1 from fs addr
           } else if (slotType == intType) {
@@ -2098,7 +2110,7 @@ public class TypeSystemImpl implements T
   public int ll_getComponentType(int arrayTypeCode) {
     final TypeImpl type = types.get(arrayTypeCode);
     if (type.isArray()) {
-      return ((TypeImpl) ((TypeImplArray)type).getComponentType()).getCode();
+      return ((TypeImpl) ((TypeImpl_array)type).getComponentType()).getCode();
     }
     return UNKNOWN_TYPE_CODE;
   }
@@ -2115,7 +2127,7 @@ public class TypeSystemImpl implements T
     if (!ti.isStringSubtype()) {
       return null;
     }
-    Set<String> allowedValues = ((TypeImplStringSubtype)ti).getAllowedValues();
+    Set<String> allowedValues = ((TypeImpl_stringSubtype)ti).getAllowedValues();
     return allowedValues.stream().toArray(i -> new String[i]);
   }
 
@@ -2128,6 +2140,10 @@ public class TypeSystemImpl implements T
     return it;
   }
   
+  public List<FeatureImpl> getFeatureImpls() {
+    return this.features;
+  }
+  
   /**
    * 
    * @param feat -
@@ -2285,9 +2301,36 @@ public class TypeSystemImpl implements T
     jcasRegisteredTypes.set(typeIndexID, ti);
   }
   
-  static {
-    new TypeSystemImpl();
+  public static final int getTypeClass(TypeImpl ti) { 
+    switch (ti.getCode()) {
+    case TypeSystemImpl.intTypeCode: return CASImpl.TYPE_CLASS_INT;
+    case TypeSystemImpl.floatTypeCode: return CASImpl.TYPE_CLASS_FLOAT;
+    case TypeSystemImpl.stringTypeCode: return CASImpl.TYPE_CLASS_STRING;
+    case TypeSystemImpl.intArrayTypeCode: return CASImpl.TYPE_CLASS_INTARRAY;
+    case TypeSystemImpl.floatArrayTypeCode: return CASImpl.TYPE_CLASS_FLOATARRAY;
+    case TypeSystemImpl.stringArrayTypeCode: return CASImpl.TYPE_CLASS_STRINGARRAY;
+    case TypeSystemImpl.fsArrayTypeCode: return CASImpl.TYPE_CLASS_FSARRAY;
+    case TypeSystemImpl.booleanTypeCode: return CASImpl.TYPE_CLASS_BOOLEAN;
+    case TypeSystemImpl.byteTypeCode: return CASImpl.TYPE_CLASS_BYTE;
+    case TypeSystemImpl.shortTypeCode: return CASImpl.TYPE_CLASS_SHORT;
+    case TypeSystemImpl.longTypeCode: return CASImpl.TYPE_CLASS_LONG;
+    case TypeSystemImpl.doubleTypeCode: return CASImpl.TYPE_CLASS_DOUBLE;
+    case TypeSystemImpl.booleanArrayTypeCode: return CASImpl.TYPE_CLASS_BOOLEANARRAY;
+    case TypeSystemImpl.byteArrayTypeCode: return CASImpl.TYPE_CLASS_BYTEARRAY;
+    case TypeSystemImpl.shortArrayTypeCode: return CASImpl.TYPE_CLASS_SHORTARRAY;
+    case TypeSystemImpl.longArrayTypeCode: return CASImpl.TYPE_CLASS_LONGARRAY;
+    case TypeSystemImpl.doubleArrayTypeCode: return CASImpl.TYPE_CLASS_DOUBLEARRAY;
+    }
+        
+    if (ti.isArray()) {
+      return CASImpl.TYPE_CLASS_FSARRAY;
+    }
+
+    return CASImpl.TYPE_CLASS_FS;
   }
+
+  public static final TypeSystemImpl staticTsi = new TypeSystemImpl();
+    
 //  public void installTypeCreator(Class<?> jcasClass) {
 //    TypeImpl ti = typeName2TypeImpl.get(jcasClass.getName());
 //    assert (ti != null);