Share

EDAM ENCHILADA

Tracker: Bugs

7 Getting the id of the first particle in collectn troubled - ID: 1604744
Last Update: Settings changed ( jtbigwoo )

See TODO's in code. Also, add a test case for the first atom of a parent
collection both with and without individual atoms in the parent collection.


L. E. Steinberg ( steinbel ) - 2006-11-28 19:18

7

Closed

Fixed

Tom Bigwood

Algorithm implementation

None

Public


Comments ( 6 )

Date: 2009-05-07 09:55
Sender: musicantSourceForge.net SubscriberProject Admin

Cool. Thanks!


Date: 2009-05-07 03:14
Sender: jtbigwooProject Admin

It was used in one spot--in the QueryDialog before it calls the SQLDivider
for the query function. It was fairly easy to get rid of.

(It was actually in two spots, but the other one was a Database method
named getAdjacentAtomInCollection that wasn't used anywhere.)

Database.java (lines 816 - 857, 3848 - 3876, 5960 - 5984),
DatabaseTest.java (lines 1198 - 1229, 1748 - 1777, 1991 - 2019),
InfoWarehouse.java (line 337)




Date: 2009-05-03 03:09
Sender: musicantSourceForge.net SubscriberProject Admin

What you say sounds right. How often is this thing used throughout the
code?


Date: 2009-05-02 18:38
Sender: jtbigwooProject Admin

getFirstAtomInCollection should probably not exist. I'm pretty sure it's
misused in every place it's called. It's being used on the assumption that
atom ids in collections are sequental--not true! You can't get the 1000th
particle in a collection by taking the first atom id and adding 1000.


Date: 2008-10-27 18:20
Sender: musicantSourceForge.net SubscriberProject Admin

Original title "getFirstAtom... for parent with atoms & subcolls needs
help"


Date: 2007-06-13 14:40
Sender: musicantSourceForge.net SubscriberProject Admin


Looking at the code, I think the problem here is possibly the opposite of
what the TODO says (but I'm not 100% sure). Luckily, it doesn't come up too
often because typically, our parent collections only have more collections,
not particles. Regardless, it seems that a much more straightforward
approach would be to use InternalAtomOrder, which keeps track of all this
info already. Create unit tests as specified above, where the first atom of
a collection with children is, and isn't, in the parent collection. One of
those should fail. Then rewrite this method using InternalAtomOrder to find
the smallest atom number in that collection.

I'd also like to know where this method is used. By changing this code,
where does it percolate? Who depends on it, and so on? I'm a little
paranoid about what might break if we get the fix wrong...


Attached File

No Files Currently Attached

Changes ( 8 )

Field Old Value Date By
close_date - 2009-07-11 16:07 jtbigwoo
allow_comments 1 2009-07-11 16:07 jtbigwoo
status_id Open 2009-07-11 16:07 jtbigwoo
assigned_to nobody 2009-05-07 03:14 jtbigwoo
resolution_id None 2009-05-07 03:14 jtbigwoo
category_id None 2009-05-07 03:14 jtbigwoo
summary getFirstAtom... for parent with atoms & subcolls needs help 2008-10-27 18:20 musicant
assigned_to steinbel 2007-06-13 14:40 musicant