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/01/23 19:15:45 UTC

svn commit: r1654288 - in /uima/uimaj/trunk/uimaj-core/src: main/java/org/apache/uima/cas/impl/CASImpl.java main/java/org/apache/uima/cas/impl/TypeSystemImpl.java test/java/org/apache/uima/util/CasCopierTest.java

Author: schor
Date: Fri Jan 23 18:15:44 2015
New Revision: 1654288

URL: http://svn.apache.org/r1654288
Log:
[UIMA-4198] minor improvement to cas copier test- dump stack on one error situation. remove no-longer-needed method in TypeSystemImpl, add comment in cas impl

Modified:
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
    uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
    uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasCopierTest.java

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java?rev=1654288&r1=1654287&r2=1654288&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/CASImpl.java Fri Jan 23 18:15:44 2015
@@ -4436,6 +4436,10 @@ public class CASImpl extends AbstractCas
     return getTypeSystem().subsumes(getAnnotationType(), t);
   }
 
+  /**
+   * @param t the type code to test
+   * @return true if that type is subsumed by AnnotationBase type
+   */
   public boolean isSubtypeOfAnnotationBaseType(int t) {
     return this.svd.casMetadata.ts.subsumes(this.svd.casMetadata.ts.annotBaseTypeCode, t);
   }

Modified: uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1654288&r1=1654287&r2=1654288&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Fri Jan 23 18:15:44 2015
@@ -1669,33 +1669,33 @@ public class TypeSystemImpl implements T
     return m;
   }
   
-  /**
-   * @param otherTs type system to compare to this one
-   * @return true if one or more identically named features have differently named ranges
-   */
-  public boolean isRangeCheckNeeded(TypeSystemImpl otherTs) {
-    if (this == otherTs) {
-      return false;
-    }
-    final List<Feature> smallerList;
-    if (features.size() > otherTs.features.size()) {
-      smallerList = otherTs.features;
-      otherTs = this; 
-    } else {
-      smallerList = features;
-    }
-    
-    for (int i = smallerList.size() - 1; i > 0; i--) { // position 0 is null
-      final Feature f1 = smallerList.get(i);
-      final Feature f2 = otherTs.getFeatureByFullName(f1.getName());
-      if (f2 == null) {
-        continue;
-      }
-      if (!f1.getRange().getName().equals(f2.getRange().getName())) {
-        return true;
-      }
-    }
-    return false;
-  }
-  
+//  /**
+//   * @param otherTs type system to compare to this one
+//   * @return true if one or more identically named features have differently named ranges
+//   */
+//  public boolean isRangeCheckNeeded(TypeSystemImpl otherTs) {
+//    if (this == otherTs) {
+//      return false;
+//    }
+//    final List<Feature> smallerList;
+//    if (features.size() > otherTs.features.size()) {
+//      smallerList = otherTs.features;
+//      otherTs = this; 
+//    } else {
+//      smallerList = features;
+//    }
+//    
+//    for (int i = smallerList.size() - 1; i > 0; i--) { // position 0 is null
+//      final Feature f1 = smallerList.get(i);
+//      final Feature f2 = otherTs.getFeatureByFullName(f1.getName());
+//      if (f2 == null) {
+//        continue;
+//      }
+//      if (!f1.getRange().getName().equals(f2.getRange().getName())) {
+//        return true;
+//      }
+//    }
+//    return false;
+//  }
+//  
 }

Modified: uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasCopierTest.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasCopierTest.java?rev=1654288&r1=1654287&r2=1654288&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasCopierTest.java (original)
+++ uima/uimaj/trunk/uimaj-core/src/test/java/org/apache/uima/util/CasCopierTest.java Fri Jan 23 18:15:44 2015
@@ -115,6 +115,7 @@ public class CasCopierTest extends TestC
     try {
       cc.copyCasView(srcCas, v2, false);
     } catch (Exception e) {
+      e.printStackTrace();
       ee = e;
     }
     assertEquals(ee, null);
@@ -201,7 +202,7 @@ public class CasCopierTest extends TestC
     // do the copy
     long shortest = Long.MAX_VALUE;
     int i = 0;
-//    for (; i < 6000; i++) {  // uncomment for perf test.  was more than 2x faster than version 2.6.0
+//    for (; i < 6000; i++) {  // uncomment for perf test.  was more than 5x faster than version 2.6.0
       destCas.reset();
       long startTime = System.nanoTime();
       copier = new CasCopier(srcCas, destCas);
@@ -278,6 +279,14 @@ public class CasCopierTest extends TestC
     // set sofa data in destination CAS (this is not copied automtically)
     destCas.setDocumentText(srcCas.getDocumentText());
 
+    // copy all entities
+    Iterator<FeatureStructure> it = srcCas.getIndexRepository().getAllIndexedFS(srcCas.getTypeSystem().getType("org.apache.uima.testTypeSystem.Entity"));
+//    while(it.hasNext()) {
+      FeatureStructure fs = it.next();
+      FeatureStructure fsc = copier.copyFs(fs);
+//      destCas.addFsToIndexes(fsc);
+      CasComparer.assertEquals(fs, fsc);
+//    }
     // copy an Annotation
     Iterator<AnnotationFS> annotIter = srcCas.getAnnotationIndex().iterator();
     FeatureStructure annot = annotIter.next();