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

Richard Eckart de Castilho commented on UIMA-1524:
--------------------------------------------------

How about using the "established" vocabulary from uimaFIT (J)CasUtil? E.g. 
coveredBy(), covering(), etc. at least when there are equivalents?

Do we need to to use a no-args method called stream or could we be more 
flexible and maybe add methods directly to CAS instead of having to go through 
indexes, e.g.

{code}
int filteredTextSum = cas.select(Token.class)  //create a stream over the 
standard annotation index for the Token type
       .reverse()    
       .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>
{code}

or

{code}
int filteredTextSum = cas.select("myindex", Token.class)  // create a stream 
over the  index "myindex" for the Token type
       .reverse()    
       .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>
{code}

> 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
(v6.3.4#6332)

Reply via email to