[Biojava-l] Nasty CompoundLocation `issue'

Thomas Down td2@sanger.ac.uk
Thu, 31 May 2001 14:02:54 +0100


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.