1

Topic: Data from a hierarchy root

Good afternoon. We admit, there is at me a tree, its peaks - objects of classes NodeClass1, NodeClass2... And RootNodeClass. That is, for example, class RootNodeClass can create at itself children of type 1 and 2, in turn NodeClass1 can have children of type 1, 3, 4, well and so on in the most different combinations. Also we admit, one of classes, NodeClassX, needs the data which are in root peak, but to its "ancestors" this data are not necessary. How it is correct them there to transfer? Whether it is necessary to drag this data through a chain of designers? Then it turns out that the majority of classes will drag as though superfluous parameter in the designer. Update: in each peak there is property Parent, however it is filled after construction whereas the data from a root is required already in the designer of class NodeClassX. Perhaps, to make so that designers of all types of peaks is mandatory demanded the link to the ancestor?

2

Re: Data from a hierarchy root

Hello, dmitry_npi, you wrote: _> Good afternoon. _> it is admissible, there is at me a tree, its peaks - objects of classes NodeClass1, NodeClass2... And RootNodeClass. That is, for example, class RootNodeClass can create at itself children of type 1 and 2, in turn NodeClass1 can have children of type 1, 3, 4, well and so on in the most different combinations. _> also it is admissible, one of classes, NodeClassX, needs the data which are in root peak, but to its "ancestors" this data are not necessary. _> as it is correct them there to transfer? Whether _> it is necessary to drag this data through a chain of designers? Then it turns out that the majority of classes will drag as though superfluous parameter in the designer. And if to transfer the link on RootNodeClass? Then everyones NodeClass1, NodeClass2 do not have need to know determination of a root class, and NodeClassX already can (knowing rut-class determination) to obtain the data necessary to it, causing its any method. However, all the same it is required to transfer, of course, through designers. Well or at all to transfer in the designer of any proxy object which contains the reference on RootNodeClass and knows as at it to learn the data. But completely hides its other interfaces, producing what-thread only one method GetDataFromRoot which   and will communicate referring to a rut-class. Then at least there is necessity child no class the nobility about . It will be hidden completely by a proxy-object, resolving only necessary and no more.

3

Re: Data from a hierarchy root

Hello, Carc, you wrote: a C> And if to transfer the link on RootNodeClass? Then everyones NodeClass1, NodeClass2 do not have need to know determination of a root class, and NodeClassX already can (knowing rut-class determination) to obtain the data necessary to it, causing its any method. However, all the same it is required to transfer, of course, through designers. A C> Well or at all to transfer in the designer of any proxy object which contains the reference on RootNodeClass and knows as at it to learn the data. But completely hides its other interfaces, producing what-thread only one method GetDataFromRoot which   and will communicate referring to a rut-class. Then at least there is necessity child no class the nobility about . It will be hidden completely by a proxy-object, resolving only necessary and no more. Thanks. Eventually forced to accept all designers the link to the parent. Thus it is possible to reach a root from any place.

4

Re: Data from a hierarchy root

Hello, dmitry_npi, you wrote: 1. I think to any child it is necessary to know about his parents, it is classical implementation xml the document.  the document is always achievable. Certainly depending on necessity it is possible to optimize access. 2. Look on Annotations in XObject. The essence that any node can store optional data (certain type) in that. It if is necessary any. If they are in advance known - that  certainly. This common decision which suits for  trees. It is proved by practice - in  we extend so - in the browser we expand object necessarily. Simply from the description not absolutely clearly that is necessary. Such general mechanism would relieve of details. As the example in xml the document - a position is stored in a file so - and only if to a parcer about it to tell - therefore in normal cases we do not pay for it. That approaches you... Who knows.

5

Re: Data from a hierarchy root

Hello, dmitry_npi, you wrote: _> Thanks. Eventually forced to accept all designers the link to the parent. Thus it is possible to reach a root from any place. This correct decision.

6

Re: Data from a hierarchy root

Hello, dmitry_npi, you wrote: _> Also it is admissible, one of classes, NodeClassX, needs the data which are in root peak, but to its "ancestors" this data are not necessary. _> as it is correct them there to transfer? Whether _> it is necessary to drag this data through a chain of designers? Then it turns out that the majority of classes will drag as though superfluous parameter in the designer. And you precisely do not try to push elements of exterior algorithm in a tree, which role - the container?

7

Re: Data from a hierarchy root