Author: schor
Date: Tue Jul 17 21:11:39 2018
New Revision: 1836129
URL: http://svn.apache.org/viewvc?rev=1836129&view=rev
Log:
[UIMA-5836][UIMA-5835][UIMA-5833]
Modified:
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
Modified:
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
URL:
http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java?rev=1836129&r1=1836128&r2=1836129&view=diff
==============================================================================
---
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
(original)
+++
uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/Subiterator.java
Tue Jul 17 21:11:39 2018
@@ -246,8 +246,8 @@ public class Subiterator<T extends Annot
this.boundsUse = (boundsUse == null) ? BoundsUse.notBounded : boundsUse;
this.isUnambiguous = !ambiguous;
if (strict) {
- if (BoundsUse.coveredBy != boundsUse) {
- throw new IllegalArgumentException("Strict requires
BoundsUse.coveredBy");
+ if (BoundsUse.coveredBy != boundsUse && BoundsUse.sameBeginEnd !=
boundsUse) {
+ throw new IllegalArgumentException("Strict requires
BoundsUse.coveredBy or BoundsUse.sameBeginEnd");
}
}
this.isStrict = strict;
@@ -1251,6 +1251,27 @@ public class Subiterator<T extends Annot
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public int size() {
+ FSIterator<T> it2 = copy();
+ int sz = 0;
+ while (it2.hasNext()) {
+ sz++;
+ it2.nextNvc();
+ }
+ return sz;
+ }
+
+ @Override
+ public FeatureStructure[] getArray() {
+ FSIterator<T> it2 = copy();
+ ArrayList<FeatureStructure> a = new ArrayList<>();
+ while (it2.hasNext()) {
+ a.add(it2.nextNvc());
+ }
+ return a.toArray(new FeatureStructure[a.size()]);
+ }
// /**
// * Simple implementation: