You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2018/07/16 13:51:00 UTC

[jira] [Assigned] (UIMA-5826) asList() ignores limit

     [ https://issues.apache.org/jira/browse/UIMA-5826?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marshall Schor reassigned UIMA-5826:
------------------------------------

    Assignee: Marshall Schor

> 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
>            Assignee: Marshall Schor
>            Priority: Major
>             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)