[Biojava-l] Adapting org.biojava.bio.seq classes to an interface?
Christian Storm
cs at is-analyse.de
Thu Dec 16 14:34:09 EST 2004
Thanks!
Ended up implementing SequenceBuilder from scratch rather than subclassing
SequenceBuilderBase, but now it works nicely.
Christian
----- Original Message -----
From: "Thomas Down" <td2 at sanger.ac.uk>
To: "Christian Storm" <cs at is-analyse.de>
Cc: <biojava-l at biojava.org>
Sent: Thursday, December 16, 2004 3:54 PM
Subject: Re: [Biojava-l] Adapting org.biojava.bio.seq classes to an
interface?
>
> On 16 Dec 2004, at 12:35, Christian Storm wrote:
>
>> Is there a way of adapting org.biojava.bio.seq classes / interfaces to an
>> interface?
>>
>> I would like to add functionality to some of the interfaces in
>> org.biojava.bio.seq, i.e. sequence and feature, by adapting them to an
>> existing interface.
>>
>> I see two possibilites - a class adapter:
>>
>> OwnSequence extends SimpleSequence implements NewFunctionality
>>
>> or an object Adapter:
>>
>> OwnSequence implements Sequence, NewFunctionality
>>
>> Unfortunately both approaches would mean massive recoding of the parsing
>> /building process of sequence-objects, so that in essence it would be
>> simpler for me to write my own classes to handle sequences.
>
> Hi Christian,
>
> The BioJava sequence model was written with the possibility of dropping in
> new implementations in mind, and it certainly ought to be possible to do
> this -- whatever approach you choose to take -- without having to rewrite
> things like parsing code. A good place to start looking is the
> SequenceBuilder interface, which receives events from the parsing
> framework and constructs Sequence objects. By developing a new
> implementation of this, you'll be able to use any of the BioJava parsers.
> Depending on the exact details of your new Sequence implementation, you'll
> quite possibly be able to get away with a very small subclass of
> SequenceBuilderBase.
>
> Thomas.
>
More information about the Biojava-l
mailing list