uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marshall Schor (JIRA)" <...@uima.apache.org>
Subject [jira] [Commented] (UIMA-1524) JFSIndexRepository should be enhanced with new generic methods
Date Mon, 12 Sep 2016 18:07:21 GMT

    [ https://issues.apache.org/jira/browse/UIMA-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15484827#comment-15484827

Marshall Schor commented on UIMA-1524:

We could overlay the additional capabilities of Annotation Indexes on the stream APIs, via
a few extra methods, something like this:

int filteredTextSum = index.stream()  //create a stream from an index
       .boundedBy(boundingAnnotation) // like subiterator
       .boundsRespectTypePriorities(true) // default is false
       .strict(true)  // default is false; same as nonOverlappingFSs(true)
       .mapToInt(f -> f.getEnd() - f.getBegin()) // get the length of the covered text
       .sum(); // add all of these</code>

Things like reverse() and boundedBy() are not normal stream operators, of course. 

> JFSIndexRepository should be enhanced with new generic methods
> --------------------------------------------------------------
>                 Key: UIMA-1524
>                 URL: https://issues.apache.org/jira/browse/UIMA-1524
>             Project: UIMA
>          Issue Type: Improvement
>          Components: Core Java Framework
>    Affects Versions: 2.3
>            Reporter: Joern Kottmann
> Existing methods should be overloaded with an additional Class argument to specify the
exact return type. This changes make down casting of returned objects unnecessary. 

This message was sent by Atlassian JIRA

View raw message