You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Richard Eckart de Castilho (JIRA)" <de...@uima.apache.org> on 2018/07/15 19:05:00 UTC
[jira] [Created] (UIMA-5826) asList() ignores limit
Richard Eckart de Castilho created UIMA-5826:
------------------------------------------------
Summary: asList() ignores limit
Key: UIMA-5826
URL: https://issues.apache.org/jira/browse/UIMA-5826
Project: UIMA
Issue Type: Bug
Components: Core Java Framework
Affects Versions: 3.0.0SDK
Reporter: Richard Eckart de Castilho
Fix For: 3.0.1SDK
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.
{code}
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());
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)