uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hugo Mougard (JIRA)" <...@uima.apache.org>
Subject [jira] [Updated] (UIMA-3913) (J)CasUtil methods could be more generic
Date Wed, 25 Jun 2014 16:44:25 GMT

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

Hugo Mougard updated UIMA-3913:
-------------------------------

    Description: 
As an example, the method {{indexCovering}} of {{JCasUtil}} has signature:
{code}
public static <T extends Annotation,S extends Annotation> Map<T, Collection<S>>
indexCovering(
  JCas jCas,
  Class<T> type,
  Class<S> coveringType)
{code}
With this signature, the following code is invalid ({{RevisedSentence}} is a subclass of {{Sentence}}):

{code}
Map<RevisedWords, Collection<Sentence>> indexRevised
                = JCasUtil.indexCovering(
                        revised,
                        RevisedWords.class,
                        RevisedSentence.class);
{code}
This somewhat prevents users of {{JCasUtil}} from benefiting of all the OOP pluses of the
UIMA TS.

Here would be a signature that would maybe better fit the problem:
{code}
public static <T extends Annotation, S extends Annotation> Map<T, Collection<S>>
indexCovering(
  JCas jCas,
  Class<? extends T> type,
  Class<? extends V> coveringType)
{code}


  was:
As an example, the method {{indexCovering}} of {{JCasUtil}} has signature:
{code}
public static <T extends Annotation,S extends Annotation> Map<T,Collection<S>>
indexCovering(
  JCas jCas,
  Class<T> type,
  Class<S> coveringType)
{code}
With this signature, the following code is invalid ({{RevisedSentence}} is a subclass of {{Sentence}}):

{code}
Map<RevisedWords, Collection<Sentence>> indexRevised
                = JCasUtil.indexCovering(
                        revised,
                        RevisedWords.class,
                        RevisedSentence.class);
{code}
This somewhat prevents users of {{JCasUtil}} from benefiting of all the OOP pluses of the
UIMA TS.

Here would be a signature that would maybe better fit the problem:
{code}
public static <U extends Annotation, V extends U, S extends Annotation, T extends S>
Map<S,Collection<U>> indexCovering(
  JCas jCas,
  Class<T> type,
  Class<V> coveringType)
{code}



> (J)CasUtil methods could be more generic
> ----------------------------------------
>
>                 Key: UIMA-3913
>                 URL: https://issues.apache.org/jira/browse/UIMA-3913
>             Project: UIMA
>          Issue Type: Improvement
>          Components: uimaFIT
>            Reporter: Hugo Mougard
>            Priority: Minor
>             Fix For: 2.2.0uimaFIT
>
>
> As an example, the method {{indexCovering}} of {{JCasUtil}} has signature:
> {code}
> public static <T extends Annotation,S extends Annotation> Map<T, Collection<S>>
indexCovering(
>   JCas jCas,
>   Class<T> type,
>   Class<S> coveringType)
> {code}
> With this signature, the following code is invalid ({{RevisedSentence}} is a subclass
of {{Sentence}}):
> {code}
> Map<RevisedWords, Collection<Sentence>> indexRevised
>                 = JCasUtil.indexCovering(
>                         revised,
>                         RevisedWords.class,
>                         RevisedSentence.class);
> {code}
> This somewhat prevents users of {{JCasUtil}} from benefiting of all the OOP pluses of
the UIMA TS.
> Here would be a signature that would maybe better fit the problem:
> {code}
> public static <T extends Annotation, S extends Annotation> Map<T, Collection<S>>
indexCovering(
>   JCas jCas,
>   Class<? extends T> type,
>   Class<? extends V> coveringType)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message