| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| hi there, i want to map a hierarchy in a tree , i have level of each node, and the parent id. any ideas? |
|
#2
| |||
| |||
| s.doroodian@gmail.com wrote: > i want to map a hierarchy in a tree , i have level of each node, and > the parent id. > any ideas? A class hierarchy? or a "composite design pattern"? Either way, they already are a tree. What problem are you trying to solve? |
|
#3
| |||
| |||
| Responding to S.doroodian@gmail.com... > i want to map a hierarchy in a tree , i have level of each node, and > the parent id. On the unlikely chance this is not a homework problem... [Tree] | 0..1 | root for | | R1 | | 1 0..* parent of [Node] -------------+ | 0..1 | | child of | R2 | | +----------------+ Actually, the level is redundant information. You an construct the tree by simply instantiating the R2 relationship between each Node and its parent. (The Node with no parent ID will be the root Node of the tree.) -- There is nothing wrong with me that could not be cured by a capful of Drano. H. S. Lahman hsl@pathfindermda.com Pathfinder Solutions http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman "Model-Based Translation: The Next Step in Agile Development". Email info@pathfindermda.com for your copy. Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php. (888)OOA-PATH |
|
#4
| |||
| |||
| On Aug 2, 2:50*am, s.dorood...@gmail.com wrote: > hi there, > * i want to map a hierarchy in a tree , i have level of each node, and > the parent id. > any ideas? I assume each node has its own id as well. Then, level is redundant, and you can restore tree structure by following id->parent_id links. This problem has nothing to do with OO. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.