[Biojava-dev] SortedMap comparator question
Matthew Pocock
matthew_pocock@yahoo.co.uk
Sun, 13 Oct 2002 15:43:19 +0100
Michael L. Heuer wrote:
> On Wed, 9 Oct 2002, Thomas Down wrote:
>
>>How about defining a little datablob class which is an
>>Object-double pair. defining a comparator over those, then
>>just using a SortedSet?
>
>
> I had thought about this, but the convenience of the keys and entrySet
> views was desireable.
I've done this before - with the pairs. It's east enough to write a set
impl in terms of (Object,double) pairs and then write a set impl that
deletagest to this for stoorage but projects the pairs back to just the
Object.
>
> What I'm going for is something like
>
> interface ScoredSet extends Set (?)
> {
> public double getScore(Object o);
> public double minScore();
> public double maxScore();
> public ScoredSet subSet(double fromScore, double toScore);
> }
>
> and
>
> interface RankedSet extends ScoredSet
> {
> public int getRank(Object o);
> public int minRank();
> public int maxRank();
> public RankedSet subSet(int fromRank, int toRank);
> }
>
> providing
>
> score rank
> object1 100.0 1
> object2 90.0 2
> object3 90.0 2
> object4 75 3
>
>
> The Set contract is nice in that in that it provides for non-duplicate
> elements, but it might not make sense to view this as a simple Collection
> after all.
>
Good luck with this. If you do write this, then I'd love to see it in
org.biojava.utils as it's a generaly usefull piece of kit to have lying
arround.
Best,
Matthew
> michael
>
> _______________________________________________
> biojava-dev mailing list
> biojava-dev@biojava.org
> http://biojava.org/mailman/listinfo/biojava-dev
>
--
BioJava Consulting LTD - Support and training for BioJava
http://www.biojava.co.uk
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com