Author: schor
Date: Mon Oct 17 19:49:13 2016
New Revision: 1765360

URL: http://svn.apache.org/viewvc?rev=1765360&view=rev
Log:
[UIMA-5115] rename updates to select framework

Modified:
    
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/SelectFSs.java
    
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
    
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/SelectFSs.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/SelectFSs.java?rev=1765360&r1=1765359&r2=1765360&view=diff
==============================================================================
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/SelectFSs.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/SelectFSs.java
 Mon Oct 17 19:49:13 2016
@@ -70,11 +70,11 @@ public interface SelectFSs<T extends Fea
   SelectFSs<T> nonOverlapping();  // AI known as unambiguous
   SelectFSs<T> nonOverlapping(boolean nonOverlapping); // AI
   
-  SelectFSs<T> endWithinBounds();  // AI known as "strict"
-  SelectFSs<T> endWithinBounds(boolean endWithinBounds); // AI
+  SelectFSs<T> includeAnnotationsWithEndBeyondBounds();  // AI known as 
"strict"
+  SelectFSs<T> includeAnnotationsWithEndBeyondBounds(boolean endWithinBounds); 
// AI
 
-  SelectFSs<T> skipEquals();                 
-  SelectFSs<T> skipEquals(boolean skipEquals);
+  SelectFSs<T> useAnnotationEquals();                 
+  SelectFSs<T> useAnnotationEquals(boolean useAnnotationEquals);
   
   // Miscellaneous
   SelectFSs<T> allViews();
@@ -198,7 +198,7 @@ public interface SelectFSs<T extends Fea
    * @param index
    * @return
    */
-  static <U extends FeatureStructure, V extends U> SelectFSs<V> 
sselect(FSIndex<U> index) {
+  static <U extends FeatureStructure, V extends U> SelectFSs<V> 
select(FSIndex<U> index) {
     return index.select();    
   } 
   

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java?rev=1765360&r1=1765359&r2=1765360&view=diff
==============================================================================
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/impl/SelectFSs_impl.java
 Mon Oct 17 19:49:13 2016
@@ -85,7 +85,7 @@ public class SelectFSs_impl <T extends F
   
   private boolean isTypePriority = false;
   private boolean isPositionUsesType = false;
-  private boolean isSkipEquals = false; // for boundsUse only
+  private boolean isUseAnnotationEquals = false; // for boundsUse only
   private boolean isNonOverlapping = false;
   private boolean isEndWithinBounds = false;
   private boolean isAllViews = false;
@@ -216,8 +216,8 @@ public class SelectFSs_impl <T extends F
    * @see org.apache.uima.cas.SelectFSs#skipEquals()
    */
   @Override
-  public SelectFSs<T> skipEquals() {
-    this.isSkipEquals = true;
+  public SelectFSs<T> useAnnotationEquals() {
+    this.isUseAnnotationEquals = true;
     return this;
   }
 
@@ -225,8 +225,8 @@ public class SelectFSs_impl <T extends F
    * @see org.apache.uima.cas.SelectFSs#skipEquals(boolean)
    */
   @Override
-  public SelectFSs<T> skipEquals(boolean aSkipEquals) {
-    this.isSkipEquals = aSkipEquals;
+  public SelectFSs<T> useAnnotationEquals(boolean useAnnotationEquals) {
+    this.isUseAnnotationEquals = useAnnotationEquals;
     return this;
   }
 
@@ -246,12 +246,12 @@ public class SelectFSs_impl <T extends F
   } 
   
   @Override
-  public SelectFSs_impl<T> endWithinBounds() { // AI known as "strict"
+  public SelectFSs_impl<T> includeAnnotationsWithEndBeyondBounds() { // AI 
known as "strict"
     isEndWithinBounds = true;
     return this;
   }  
   @Override
-  public SelectFSs_impl<T> endWithinBounds(boolean bEndWithinBounds) { // AI
+  public SelectFSs_impl<T> includeAnnotationsWithEndBeyondBounds(boolean 
bEndWithinBounds) { // AI
     isEndWithinBounds = bEndWithinBounds;
     return this;
   } 
@@ -459,7 +459,10 @@ public class SelectFSs_impl <T extends F
     
     final boolean isUseAnnotationIndex = 
         ((index != null) && (index instanceof AnnotationIndex)) ||
-        isNonOverlapping || 
+        isNonOverlapping ||
+        isPositionUsesType ||
+        isTypePriority ||
+        isEndWithinBounds || 
         boundsUse != BoundsUse.notBounded ||
         isFollowing || isPreceding;
     
@@ -467,6 +470,10 @@ public class SelectFSs_impl <T extends F
       forceAnnotationIndex();  // throws if non-null index not an annotation 
index
     }
     
+    if (isTypePriority) {
+      isPositionUsesType = true;
+    }
+        
     if (ti == null) {
       if (index != null) {
         ti = (TypeImpl) index.getType();
@@ -649,7 +656,7 @@ public class SelectFSs_impl <T extends F
         boundsUse,
         isTypePriority, 
         isPositionUsesType, 
-        isSkipEquals,              
+        isUseAnnotationEquals,              
         v.indexRepository.getAnnotationFsComparator());
     }
     

Modified: 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
URL: 
http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java?rev=1765360&r1=1765359&r2=1765360&view=diff
==============================================================================
--- 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
 (original)
+++ 
uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/test/java/org/apache/uima/cas/test/AnnotationIteratorTest.java
 Mon Oct 17 19:49:13 2016
@@ -50,7 +50,7 @@ import org.apache.uima.jcas.tcas.Annotat
 
 import junit.framework.TestCase;
 
-import static org.apache.uima.cas.SelectFSs.sselect;
+import static org.apache.uima.cas.SelectFSs.select;
 
 /**
  * Class comment for FilteredIteratorTest.java goes here.
@@ -311,10 +311,10 @@ public class AnnotationIteratorTest exte
 //      FSIndexFlat.enabled ? it instanceof FSIndexFlat.FSIteratorFlat : it 
instanceof FSIteratorWrapper);   
     assertCount("Normal ambiguous annot iterator", annotCount, it);
     assertCount("Normal ambiguous select annot iterator", annotCount, 
select_it);
-    assertEquals(annotCount, sselect(annotIndex).toArray().length);  // stream 
op
-    assertEquals(annotCount, 
sselect(annotIndex).asArray(Annotation.class).length);  // select op
+    assertEquals(annotCount, select(annotIndex).toArray().length);  // stream 
op
+    assertEquals(annotCount, 
select(annotIndex).asArray(Annotation.class).length);  // select op
     
-    AnnotationFS[] tokensAndSentences = 
sselect(annotIndex).asArray(AnnotationFS.class);
+    AnnotationFS[] tokensAndSentences = 
select(annotIndex).asArray(AnnotationFS.class);
     JCas jcas = null;
     try {
       jcas = cas.getJCas();
@@ -331,7 +331,7 @@ public class AnnotationIteratorTest exte
     assertCount("fslhead ambiguous select annot iterator", annotCount, 
select_it);
     
     // backwards
-    select_it = sselect(annotIndex).backwards().fsIterator();
+    select_it = select(annotIndex).backwards().fsIterator();
     assertCount("Normal select backwards ambiguous annot iterator", 
annotCount, select_it);
     
     it = annotIndex.iterator(false);  // false means create an unambiguous 
iterator
@@ -347,26 +347,27 @@ public class AnnotationIteratorTest exte
     assertCount("Unambigous select sentence iterator", 5, select_it);
     select_it = sentIndex.<AnnotationFS>select().nonOverlapping().fsIterator();
     assertCount("Unambigous select sentence iterator", 5, select_it);
-    select_it = sselect(sentIndex).nonOverlapping().fsIterator();
+    select_it = select(sentIndex).nonOverlapping().fsIterator();
     assertCount("Unambigous select sentence iterator", 5, select_it);
     
     
     AnnotationFS bigBound = this.cas.createAnnotation(this.sentenceType, 10, 
41);
     it = annotIndex.subiterator(bigBound, true, true);  // ambiguous, and 
strict
     assertCount("Subiterator over annot with big bound, strict", 38, it);
-    select_it = cas.<AnnotationFS>select().coveredBy((Annotation) 
bigBound).endWithinBounds().fsIterator();
+    select_it = cas.<AnnotationFS>select().coveredBy((Annotation) 
bigBound).includeAnnotationsWithEndBeyondBounds().fsIterator();
     assertCount("Subiterator select over annot with big bound, strict", 38, 
select_it);
 
-    select_it = 
cas.<AnnotationFS>select().coveredBy(bigBound).limit(7).endWithinBounds().fsIterator();
+    select_it = 
cas.<AnnotationFS>select().coveredBy(bigBound).limit(7).includeAnnotationsWithEndBeyondBounds().fsIterator();
     assertCountLimit("Subiterator select limit 7 over annot with big bound, 
strict", 7, select_it);
     
     FSIndex<Token> token_index = null;
     // uncomment these to check compile-time generic arguments OK
     // comment these out for running, because Token not a type
 //    FSIterator<Token> token_it = token_index.<Token>select().fsIterator();
-//    token_it = sselect(token_index).fsIterator();
-//    token_it = sselect(annotIndex, Token.class).fsIterator();
+//    token_it = select(token_index).fsIterator();
+//    token_it = select(annotIndex, Token.class).fsIterator();
 //    FSIterator<Token> token_it = cas.select(Token.class).fsIterator();
+//    FSIterator<Token> token_it = 
token_index.select(Token.class).fsIterator();
     
     Object[] o = 
cas.<AnnotationFS>select().coveredBy(bigBound).skip(3).toArray();
     assertEquals(35, o.length);
@@ -382,9 +383,9 @@ public class AnnotationIteratorTest exte
     
     it = annotIndex.subiterator(bigBound, false, true);  // unambiguous, strict
     assertCount("Subiterator over annot unambiguous strict", 3, it);
-    select_it = cas.<AnnotationFS>select().coveredBy((Annotation) 
bigBound).endWithinBounds().nonOverlapping().fsIterator();
+    select_it = cas.<AnnotationFS>select().coveredBy((Annotation) 
bigBound).includeAnnotationsWithEndBeyondBounds().nonOverlapping().fsIterator();
     assertCount("Subiterator select over annot unambiguous strict", 3, 
select_it);
-    select_it = cas.<AnnotationFS>select().backwards().coveredBy((Annotation) 
bigBound).endWithinBounds().nonOverlapping().fsIterator();
+    select_it = cas.<AnnotationFS>select().backwards().coveredBy((Annotation) 
bigBound).includeAnnotationsWithEndBeyondBounds().nonOverlapping().fsIterator();
     assertCount("Subiterator select over annot unambiguous strict", 3, 
select_it);
 
 //    it = annotIndex.subiterator(bigBound, true, false);
@@ -397,16 +398,16 @@ public class AnnotationIteratorTest exte
     assertCount("Subiterator over annot ambiguous not-strict", 46, it);
     
     // covered by implies endWithinBounds
-    select_it = sselect(annotIndex).coveredBy(bigBound).fsIterator();
+    select_it = select(annotIndex).coveredBy(bigBound).fsIterator();
     assertCount("Subiterator select over annot ambiguous not-strict", 38, 
select_it);
     select_it = 
annotIndex.<AnnotationFS>select().coveredBy(bigBound).fsIterator();
     assertCount("Subiterator select over annot ambiguous not-strict", 38, 
select_it);
-    select_it = 
sselect(annotIndex).coveredBy(bigBound).endWithinBounds(false).fsIterator();
+    select_it = 
select(annotIndex).coveredBy(bigBound).includeAnnotationsWithEndBeyondBounds(false).fsIterator();
     assertCount("Subiterator select over annot ambiguous not-strict", 46, 
select_it);
     
     it = annotIndex.subiterator(bigBound, false, false);  // unambiguous, not 
strict
     assertCount("Subiterator over annot, unambiguous, not-strict", 4, it);
-    select_it = 
sselect(annotIndex).nonOverlapping().coveredBy(bigBound).endWithinBounds(false).fsIterator();
+    select_it = 
select(annotIndex).nonOverlapping().coveredBy(bigBound).includeAnnotationsWithEndBeyondBounds(false).fsIterator();
     assertCount("Subiterator select over annot unambiguous not-strict", 4, 
select_it);
     
     AnnotationFS sent = 
this.cas.getAnnotationIndex(this.sentenceType).iterator().get();
@@ -485,9 +486,9 @@ public class AnnotationIteratorTest exte
     assertTrue(x);
     cas.<AnnotationFS>select().coveredBy(3, 5).singleOrNull();
     
-    select_it = sselect(annotIndex).following(2, 39).limit(2).fsIterator();
+    select_it = select(annotIndex).following(2, 39).limit(2).fsIterator();
     assertCountLimit("Following", 2, select_it);
-    select_it = sselect(annotIndex).following(2, 
39).backwards().limit(2).fsIterator();
+    select_it = select(annotIndex).following(2, 
39).backwards().limit(2).fsIterator();
     assertCountLimit("Following", 2, select_it);
     
     select_it = fsa.<AnnotationFS>select(sentenceType).fsIterator();
@@ -650,7 +651,7 @@ public class AnnotationIteratorTest exte
     for (AnnotationFS sa : ssi) {
     
       FSIterator<AnnotationFS> ti2 = tokenIdx.<AnnotationFS>select()
-          .coveredBy(sa).endWithinBounds(false).nonOverlapping().fsIterator();
+          
.coveredBy(sa).includeAnnotationsWithEndBeyondBounds(false).nonOverlapping().fsIterator();
       
       while (ti2.hasNext()) {
         AnnotationFS t = ti2.next();


Reply via email to