Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 171126 - [Viewers] TreeViewerRow: use iteration instead of recursion
Summary: [Viewers] TreeViewerRow: use iteration instead of recursion
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Thomas Schindl CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-20 00:24 EST by Boris Bokowski CLA
Modified: 2007-05-03 17:52 EDT (History)
0 users

See Also:


Attachments
Patch to address the equals-problems (2.60 KB, patch)
2007-01-20 08:41 EST, Thomas Schindl CLA
no flags Details | Diff
Updated to add contribution info (3.40 KB, patch)
2007-01-20 08:46 EST, Thomas Schindl CLA
no flags Details | Diff
Remove code dups and use iteration (1.45 KB, patch)
2007-04-16 19:56 EDT, Thomas Schindl CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Bokowski CLA 2007-01-20 00:24:55 EST
This bug lists implementation issues I have with the patch from bug 167325 (I already released the patch to HEAD because I wanted to have the API in place):

The methods getRowBelow and getRowAbove are more complicated than they need to be, in particular, they (or the methods they call) use recursion where iteration would work just as well.

findLastVisibleItem and findLowestLeaf seem to have the exact same implementation.

ViewerCell implements equals(), it should also implement hashCode() in a way that is consistent with the equals implementation (any two objects that are equals() must return the same hash code!).  This may not be important right now, but it is good practice to implement both equals() and hashCode() rather than just one of them.  I would recommend using Source->Generate hashCode() and equals().  Select both fields and then rewrite the generated methods to use getItem() instead of row.
Comment 1 Thomas Schindl CLA 2007-01-20 08:41:26 EST
Created attachment 57208 [details]
Patch to address the equals-problems
Comment 2 Thomas Schindl CLA 2007-01-20 08:46:52 EST
Created attachment 57209 [details]
Updated to add contribution info
Comment 3 Thomas Schindl CLA 2007-03-19 11:08:16 EDT
Rescheduling for M7
Comment 4 Thomas Schindl CLA 2007-04-16 19:56:21 EDT
Created attachment 63964 [details]
Remove code dups and use iteration

is this all?
Comment 5 Boris Bokowski CLA 2007-04-16 20:57:55 EDT
Looks better than what we have :)
Comment 6 Thomas Schindl CLA 2007-04-17 14:32:25 EDT
Released > 20070417
Comment 7 Thomas Schindl CLA 2007-05-03 17:52:19 EDT
Verified in I20070502-1800 by code inspection