[Biojava-l] Nasty CompoundLocation `issue'

Cox, Greg gcox@netgenics.com
Thu, 31 May 2001 09:19:10 -0400


My initial response is to have to constructor sort the list passed in.
What's the payoff for making the constructor protected and accessing it
through a static method?  

Greg

-----Original Message-----
From: Thomas Down [mailto:td2@sanger.ac.uk]
Sent: Thursday, May 31, 2001 9:03 AM
To: biojava-l@biojava.org
Subject: [Biojava-l] Nasty CompoundLocation `issue'


A warning about the public constructor on CompoundLocation:

   public CompoundLocation(List locs);

This is assuming that the list you passed in is already sorted
into ascending order.  If not, getMin() and getMax() may
return incorrect values!  I think this might have crept in
during the post-bootcamp Location refactoring.  It won't
affect /too/ many people since usually CompoundLocations
get built using the union operator.  However, this is can
be quite expensive for building big locations, so it's
still useful to be able to construct a Location from
a list of blocks.

What I'd propose:

  - Make the CompoundLocation(List) constructor package
    private.

  - Make the LocationTools.buildLoc(List) method (currently
    protected) public, and make this the official, safe, way
    to build a CompoundLocation from a list.

What do people feel about this?

   Thomas. 
_______________________________________________
Biojava-l mailing list  -  Biojava-l@biojava.org
http://biojava.org/mailman/listinfo/biojava-l