I've made an (I hope) equivalent change. We try to handle this sort of
thing at a low level - thus the code that changes a component's value calls
DXChangedComponentValue, so that the data model infrastructure can
determine what is affected and has to be updated. That code (in
libdx/helper.c) was not handling invalid components correctly. In
particular, changing the value of "invalid positions" may invaidate
previously valid connections, and invalidating connections may leave some
positions unreferenced (and by convention, invalid). In either case, the
corresponding positions and connections components are indirectly changed,
and other stuff derived from them (such as the data statistics component)
require updating. By making this change in helper.c, any other place that
calls DXChangedComponentValue will also be fixed.
As an aside, DX does not assume that there's always a statistics or a box
component. These are computed on demand, and retained if possible. So
here, the right thing to do is simply delete the derived components, and
let them be recomputed later if they are needed.
Greg
Nils Smeds
<[EMAIL PROTECTED]> To:
[email protected]
Sent by: cc:
[EMAIL PROTECTED] Subject: [opendx-dev] Patch for
Replace to update statistics on change of
son.ibm.com invalids
09/10/2002 04:52 AM
Please respond to
opendx-dev
The attached patch causes Replace to recompute the DXStatistics
attribute of the data component in case the invalid positions or invalid
connections component have been replaced. This is probably sufficient in
most situations. However, it might be more appropriate to loop over all
components and look for the simultaneous presence of a "dep" attribute
on the replaced field and presence of a statistics component. Then, one
may recompute the statistics for all relevant components.
As I am still a bit confused about what is a field/component/attribute
and where, I didn't quickly enough find an example of a loop over all
components and finally wasn't sure this was a good idea anyway I left it
at this "quick and easy" approach until someone convinces me it should be
made in more rigorously.
/Nils
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Nils Smeds http://www.pdc.kth.se/
Center for Parallel Computers e-mail: [EMAIL PROTECTED]
Royal Institute of Technology Voice: +46-8-7909115
KTH Fax: +46-8-247784
S-100 44 Stockholm, Sweden Office: OB2, room 1546
-----------------------------------------------------------------------
#### Replace-invalids-patch has been removed from this note on September 10
2002 by Gregory D Abram