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 2016/05/13 15:26:53 UTC

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

Author: schor
Date: Fri May 13 15:26:53 2016
New Revision: 1743693

URL: http://svn.apache.org/viewvc?rev=1743693&view=rev
Log:
[UIMA-4932] add check for missing sofa ref; remove unused method, replace _typeImpl with _getTypeImpl(), rename autoindexname to _DefaultBagGeneratedIndex 

Modified:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/FSIndexRepositoryImpl.java

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=1743693&r1=1743692&r2=1743693&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 Fri May 13 15:26:53 2016
@@ -50,6 +50,7 @@ import org.apache.uima.internal.util.Int
 import org.apache.uima.internal.util.Misc;
 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;
 
@@ -1112,15 +1113,7 @@ public class FSIndexRepositoryImpl imple
       action.accept(fs);
     }
   }
-  
-  /**
-   * plus means all reachable, plus maybe others not reachable but not yet gc'd
-   * @param action -
-   */
-  public void walkReachablePlusFSsSorted(Consumer<TOP> action) {
-    cas.walkReachablePlusFSsSorted(action);
-  }
-  
+    
   public FsIndex_singletype<TOP> getNonSetSingleIndexForType(int typecode) {
     return getIndexesForType(typecode).getNonSetIndex().fsIndex_singletype;
   }
@@ -1243,13 +1236,18 @@ public class FSIndexRepositoryImpl imple
   }
   
   private <T extends TOP> void addFS_common(T fs, boolean isAddback) {
-    TypeImpl ti = ((FeatureStructureImplC)fs)._typeImpl;
+    TypeImpl ti = ((FeatureStructureImplC)fs)._getTypeImpl();
     final int typeCode = ti.getCode();    
 
     // https://issues.apache.org/jira/browse/UIMA-4099
     // skip test for wrong view if addback, etc.
  
     if (!isAddback && (!IS_DISABLE_ENHANCED_WRONG_INDEX_CHECK) && ti.isAnnotationBaseType()) {
+      Sofa sofa = ((AnnotationBase)fs).getSofa();
+      if (sofa == null) {
+        throw new CASRuntimeException(
+            CASRuntimeException.SOFAREF_NOT_SET, fs.toString(3));            
+      }
       
       // Check that the annotationBase FS is being added to the proper Cas View
       CASImpl indexView = fs._getView();
@@ -1317,14 +1315,14 @@ public class FSIndexRepositoryImpl imple
   }
 
   private static final String getAutoIndexNameForType(Type type) {
-    return "_" + type.getName() + "_GeneratedIndex";
+    return "_" + type.getName() + "_DefaultBagGeneratedIndex";
   }
 
   boolean removeFS_ret(TOP fs, boolean skipBagIndexes) {
     if (skipBagIndexes && !fs._inSetSortedIndex()) {
       return false;
     }
-    final int typeCode = fs._typeImpl.getCode();
+    final int typeCode = fs._getTypeImpl().getCode();
     final IndexesForType i4t = getIndexesForType(typeCode);
     final ArrayList<FsIndex_iicp<TOP>> indexes4type = i4t.indexesForType;
 
@@ -1474,7 +1472,7 @@ public class FSIndexRepositoryImpl imple
 //   * @return true if this fs is found in a Set or Sorted index.  
 //   */
 //  public boolean isInSetOrSortedIndexInThisView(FeatureStructureImplC fs) {
-//    final TypeImpl ti = fs._typeImpl;
+//    final TypeImpl ti = fs._getTypeImpl();
 //    
 //    final IndexesForType i4t = indexArray[ti.getCode()];
 //    
@@ -1531,7 +1529,7 @@ public class FSIndexRepositoryImpl imple
 //  boolean removeIfInCorrputableIndexInThisView(FeatureStructure afs) {
 //    return removeFS_ret((TOP) afs, SKIP_BAG_INDEXES);
 ////    TOP fs = (TOP) afs;
-////    TypeImpl ti = fs._typeImpl;
+////    TypeImpl ti = fs._getTypeImpl();
 ////    final IndexesForType i4t = getIndexesForType(ti.getCode());
 //// 
 ////    int si = i4t.aSortedIndex;