On 19. Nov 2018, at 21:31, Marshall Schor <[email protected]> wrote:
>
> Can you say where the feature structure order changed in comparison to v2?
> I'm
> trying to keep things as much as reasonably possible the same, except if there
> is some kind of performance implication, etc.
The following code seems to work consistently for UIMA v2, but fails sooner or
later for UIMA v3.
----
@Test
public void thatIterationOrderOfAnnotationBaseFSesIsCorrect() throws
Exception
{
for (int e = 0; e < 1000; e++) {
TypeSystemDescription tsd = new TypeSystemDescription_impl();
TypeDescription td = tsd.addType("TestType", "",
CAS.TYPE_NAME_ANNOTATION_BASE);
td.addFeature("value", "", CAS.TYPE_NAME_INTEGER);
CAS cas = CasCreationUtils.createCas(tsd, null, null);
Type type = cas.getTypeSystem().getType("TestType");
Feature feat = type.getFeatureByBaseName("value");
for (int i = 0; i < 1000; i ++) {
FeatureStructure fs = cas.createFS(type);
fs.setIntValue(feat, i);
cas.addFsToIndexes(fs);
}
int next = 0;
FSIterator<FeatureStructure> i =
cas.getIndexRepository().getAllIndexedFS(type);
while (i.hasNext()) {
FeatureStructure fs = i.next();
assertEquals(next, fs.getIntValue(feat));
next ++;
}
}
}
----
Cheers,
-- Richard