Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-5826

asList() ignores limit

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.0SDK
    • Fix Version/s: 3.0.1SDK
    • Component/s: Core Java Framework
    • Labels:
      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());
      
      

        Attachments

          Activity

            People

            • Assignee:
              schor Marshall Schor
              Reporter:
              rec Richard Eckart de Castilho
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: