You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2009/06/08 10:46:52 UTC
Generics and FSIndex
Hello,
right now every FSIndex uses FeatureStructure as the generics parameter for
the Iterator it can provide. That means that the AnnoationIndex also
must provide
an FeatureStructure Iterator and not an AnnotationFS Iterator which
would be much
nicer in client code.
I would like to suggest to change the generic parameter of the Iterator to
? extends FeatureStructure, then AnnotationIndex can reduce it to
AnnotationFS.
Would do others think ?
Jörn
Re: Generics and FSIndex
Posted by Tommaso Teofili <to...@gmail.com>.
2009/6/8 Jörn Kottmann <ko...@gmail.com>
> Hello,
>
> right now every FSIndex uses FeatureStructure as the generics parameter for
> the Iterator it can provide. That means that the AnnoationIndex also must
> provide
> an FeatureStructure Iterator and not an AnnotationFS Iterator which would
> be much
> nicer in client code.
>
> I would like to suggest to change the generic parameter of the Iterator to
> ? extends FeatureStructure, then AnnotationIndex can reduce it to
> AnnotationFS.
I agree
>
>
> Would do others think ?
>
> Jörn
>
Re: Generics and FSIndex
Posted by Thilo Goetz <tw...@gmx.de>.
Sounds good to me.
--Thilo
Adam Lally wrote:
> FYI, a while back I posted some code we could consider adding for JCAS
> that allow you to get iterators parameterized by specific JCAS types:
> http://www.mail-archive.com/uima-dev@incubator.apache.org/msg04657.html
>
> It might be interesting to consider adding something like that
> directly on the JCAS interface.
>
> -Adam
>
> On Tue, Jun 9, 2009 at 4:52 AM, Jörn Kottmann<ko...@gmail.com> wrote:
>> Thilo Goetz wrote:
>>> Jörn Kottmann wrote:
>>>
>>>> Hello,
>>>>
>>>> right now every FSIndex uses FeatureStructure as the generics parameter
>>>> for
>>>> the Iterator it can provide. That means that the AnnoationIndex also
>>>> must provide
>>>> an FeatureStructure Iterator and not an AnnotationFS Iterator which
>>>> would be much
>>>> nicer in client code.
>>>>
>>>> I would like to suggest to change the generic parameter of the Iterator
>>>> to
>>>> ? extends FeatureStructure, then AnnotationIndex can reduce it to
>>>> AnnotationFS.
>>>>
>>>> Would do others think ?
>>>>
>>> +1
>>>
>> Its now checked in.
>>
>> Maybe you can have a look at it:
>> http://svn.apache.org/viewcvs?view=rev&rev=782908
>> http://svn.apache.org/viewcvs?view=rev&rev=782914
>>
>> Jörn
>>
Re: Generics and FSIndex
Posted by Jörn Kottmann <ko...@gmail.com>.
Adam Lally wrote:
> FYI, a while back I posted some code we could consider adding for JCAS
> that allow you to get iterators parameterized by specific JCAS types:
> http://www.mail-archive.com/uima-dev@incubator.apache.org/msg04657.html
>
> It might be interesting to consider adding something like that
> directly on the JCAS interface.
>
> -Adam
>
I changed my mind a little about adding this specific method
to the JCas class, because the same issue is true for the normal
CAS where people might want to use for each to iterate
over our built in types.
I think we should add something like that to the FSIndexRepository.
For the methods which return an FSIndex that would work quite well,
but not for getAllIndexedFS, because it returns an FSItertor which
cannot be used together with the for each statement.
One way to solve it would be to let the new getAllIndexedFS method return
a Collection or let FSIterator extend Iterable. Though I am not sure what
are the consequences to have an Iterator extending Iterable.
Jörn
Re: Generics and FSIndex
Posted by Jörn Kottmann <ko...@gmail.com>.
Adam Lally wrote:
> FYI, a while back I posted some code we could consider adding for JCAS
> that allow you to get iterators parameterized by specific JCAS types:
> http://www.mail-archive.com/uima-dev@incubator.apache.org/msg04657.html
>
> It might be interesting to consider adding something like that
> directly on the JCAS interface.
>
Yeah, that would be nice.
Jörn
Re: Generics and FSIndex
Posted by Adam Lally <al...@alum.rpi.edu>.
FYI, a while back I posted some code we could consider adding for JCAS
that allow you to get iterators parameterized by specific JCAS types:
http://www.mail-archive.com/uima-dev@incubator.apache.org/msg04657.html
It might be interesting to consider adding something like that
directly on the JCAS interface.
-Adam
On Tue, Jun 9, 2009 at 4:52 AM, Jörn Kottmann<ko...@gmail.com> wrote:
> Thilo Goetz wrote:
>>
>> Jörn Kottmann wrote:
>>
>>>
>>> Hello,
>>>
>>> right now every FSIndex uses FeatureStructure as the generics parameter
>>> for
>>> the Iterator it can provide. That means that the AnnoationIndex also
>>> must provide
>>> an FeatureStructure Iterator and not an AnnotationFS Iterator which
>>> would be much
>>> nicer in client code.
>>>
>>> I would like to suggest to change the generic parameter of the Iterator
>>> to
>>> ? extends FeatureStructure, then AnnotationIndex can reduce it to
>>> AnnotationFS.
>>>
>>> Would do others think ?
>>>
>>
>> +1
>>
>
> Its now checked in.
>
> Maybe you can have a look at it:
> http://svn.apache.org/viewcvs?view=rev&rev=782908
> http://svn.apache.org/viewcvs?view=rev&rev=782914
>
> Jörn
>
Re: Generics and FSIndex
Posted by Jörn Kottmann <ko...@gmail.com>.
Thilo Goetz wrote:
> Jörn Kottmann wrote:
>
>> Hello,
>>
>> right now every FSIndex uses FeatureStructure as the generics parameter for
>> the Iterator it can provide. That means that the AnnoationIndex also
>> must provide
>> an FeatureStructure Iterator and not an AnnotationFS Iterator which
>> would be much
>> nicer in client code.
>>
>> I would like to suggest to change the generic parameter of the Iterator to
>> ? extends FeatureStructure, then AnnotationIndex can reduce it to
>> AnnotationFS.
>>
>> Would do others think ?
>>
>
> +1
>
Its now checked in.
Maybe you can have a look at it:
http://svn.apache.org/viewcvs?view=rev&rev=782908
http://svn.apache.org/viewcvs?view=rev&rev=782914
Jörn
Re: Generics and FSIndex
Posted by Thilo Goetz <tw...@gmx.de>.
Jörn Kottmann wrote:
> Hello,
>
> right now every FSIndex uses FeatureStructure as the generics parameter for
> the Iterator it can provide. That means that the AnnoationIndex also
> must provide
> an FeatureStructure Iterator and not an AnnotationFS Iterator which
> would be much
> nicer in client code.
>
> I would like to suggest to change the generic parameter of the Iterator to
> ? extends FeatureStructure, then AnnotationIndex can reduce it to
> AnnotationFS.
>
> Would do others think ?
+1
--Thilo
>
> Jörn