473,657 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding an instance to a data tree

Hi,
I have a data tree. A node in the tree "assembles" itself when called
upon to do so by the level-of-detail algorithm.
It creates and adds its children to itself using a base class method
called "add". However in the pseudo-constructor called "setup", the
child node needs to be already linked into the tree in order to obtain
configuration information. So the "add" method creates the child,
optionally positions it within the parents frame of reference, then
invokes the child's setup method which has variable length arguments.
Here is an example of code in an assemble method.

self.add("Reser voir", (Reservoir, r, r +
self.inner_tank _thickness))
self.add("End_t ank", (End_tank, r,
self.outer_tank _radius),
0.5*self.payloa d_length +
0.5*self.outer_ tank_thickness)
self.add("Inner _end_tank", (End_tank, r,
self.outer_tank _radius),
-0.5*self.payloa d_length
-0.5*self.outer_ tank_thickness)
self.add("Zero_ G_port", Zero_G_port,
0.5*self.payloa d_length
-0.5*self.zg_len gth)
self.add("Hanga r-floor", Hangar)
self.add("herc" , Hercules_shuttl e,
(0.5*self.paylo ad_length - 25,
R3d(180.0,V3d(0 ,1,0))))
self.add("herc1 ", Hercules_shuttl e,

(V3d(0,-12.5,0.5*self.p ayload_length - 25), R3d(180.0,V3d(0 ,1,0))))

The add method takes the parameters "name", child-information, and
optional location-information.
The child information is either a class, or a tuple whose first member
is a class. The remaining members of the tuple are parameters to the
class setup method.

The problem is this: Sometimes the setup method parameters are quite
numerous, leading to problems when the order is misjudged. If invoked
directly, then naming parameters minimises the problems with missed
parameters. However the indirect creation via the "add" method means
the parameters are passed in a tuple, so the parameters cannot be
named.

How can I "pre-construct" the children with parent id and optional
location information, and also implement the advantages of named
function parameters?
Looking for all suggestions.

Dec 19 '06 #1
1 1020

And of course the solution occurs to me about 30 minutes after posting,
to have the add method return an instance which then invokes setup.
self.add(name, child_type, other_info).set up(child-setup-parameters)

Dec 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
9769
by: muralidharan | last post by:
WebForm1.aspx Code: <%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI" Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView id="TreeView1" Height="520" AutoPostBackOnNodeMove="false" DragAndDropEnabled="true" NodeEditingEnabled="False" KeyboardEnabled="true" CssClass="TreeView" NodeCssClass="TreeNode" SelectedNodeCssClass="SelectedTreeNode" HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
2
1632
by: New | last post by:
Why does this code insert a node into a binary search tree correctly? If I only inserting going by first digit it works properly but when I try inserting going by the whole ip and the port number the inserts are totally out of order. where IPAddress is four ints Node is an IPAddress, portNumber, left pointer and right pointer Nodeptr is a pointer to a Node
9
5482
by: James Geurts | last post by:
Hey all... I posted this in the vs.net ide group too, but people are not answering, so I figured that it might be more appropriate here. I'm not sure if I'm adding a designer to my code properly. I'm only adding it to the tree node, where each custom tree node is then added to a normal tree control I'm trying to get an add-in to interact with the property window in VS.Net. Basically, I created a tool window containing a custom tree...
3
2468
by: Brian Henry | last post by:
If i already have a tree view created, and want to add another new node to it, how would i do so? Is there a way to throught tags or anything? like i have this RootNode | +-- Child 1 +-- Child 2 and i want to add a child node to child 1 how would i refrence it and add a
4
2303
by: pmcguire | last post by:
I have a treeview with a lot of nodes. I want to load only the nodes that are initially visible when the form loads, and then continue to populate it in background and/or when the nodes are required by the user either scrolling or performing some other action that would move the treeview window to a particular "unloaded" node in the treeview Any advice on how to go about this? It seems I need a way of sensing a scroll event in the treeview...
4
1241
by: Paul McKenna | last post by:
Hello I have a treeview control on my form. The nodes of this tree are populated with values from an XML file. Is there a way by which I could bind objects to the tree instead of simple strings? This would make it easier for me to refer data referenced by each node instead of having to re-read the XML file each time. Thank You
12
1594
by: Bob Jones | last post by:
I have an odd business requirement and I think that the implementation is not correct in the terms of OOP development. Any help on the concepts would be very appreciated! We currently have a custom Page object which is derived from the base Page object. We also have custom controls that derive from a base class that performs custom drawing and inherits from our own IOurControl interface. There is also a special caching layer in the mix...
2
15065
by: ChrisCicc | last post by:
Hi All, I got a real doozy here. I have read hundreds upon hundreds of forum posts and found numerous others who have replicated this problem, but have yet to find a solution. Through testing I have been able to find the cause of the problem, and will describe it here first textually and then through a code example. The purpose of what I am trying to do is to create a postback-free web application through the use of ASP.net AJAX UpdatePanels...
21
2369
by: John Henry | last post by:
Hi list, I have a need to create class methods on the fly. For example, if I do: class Dummy: def __init__(self): exec '''def method_dynamic(self):\n\treturn self.method_static("it's me")''' return
0
8743
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8622
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.