Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.0.0SDK
-
None
Description
In the following code, the `precedingsTokens` list should contain two elements. In fact, it does, but the `size()` method of the list still returns 6. That is because `org.apache.uima.cas.impl.SelectFSs_impl.asList()` simply uses the size of the underlying index and does not take into account limit or direction options from the select.
jCas.setDocumentText("abcde"); *new* Token(jCas, 0, 1).addToIndexes(); *new* Token(jCas, 1, 2).addToIndexes(); *new* Token(jCas, 2, 3).addToIndexes(); *new* Token(jCas, 3, 4).addToIndexes(); *new* Token(jCas, 4, 5).addToIndexes(); *new* Token(jCas, 1, 3).addToIndexes(); Token c = JCasUtil.selectAt(jCas, Token.*class*, 2, 3).get(0); List<Token> preceedingTokens = jCas.select(Token.*class*).preceding(c).limit(2).asList(); assertEquals(2, preceedingTokens.size());