[jdom-interest] Events for JDOM

Sébastien Pierre spierre at isb-sib.ch
Mon Nov 19 09:27:26 PST 2001


Hi Paul!

Le lundi 19 novembre 2001, à 05:24 PM, Paul Libbrecht a écrit :
>>  - Re-implement parts of the Element class. This has the advantage 
>> that you can optimize access to elements (in my case this means 
>> optimizing iteration on element content and direct modification of the 
>> lists instead of a setContent). You can also choose what you want to 
>> monitor and how.
>
> Do you mean simply ensure that the getContent() method returns you a 
> real list where the listIterator can delete and replace ??
> I've been assuming this (changing the source appropriately) as this 
> should come with the newer FilterList.

That's it. I have an application where I very often have to make small 
modifications to an element content, in this case it is slow to create a 
new list per modification and then call the setContent() method. Having 
a mutable list would accelerate my application. BTW, was is this 
FilterList ?

>>  - Make a wrapper around the elements you want to monitor, in this 
>> case you can leave the JDom classes as is- the advantage is that if 
>> the wrapper is well done it can be used by others without having to be 
>> merged into the JDOM API.
>
> Well... I'm currently trying to perform the implementation of these 
> "Recipes"-like event. I have almost a kind of interface.

I would be interested on some details about that :)

> (...)
> In particular, in order to perform this removal, you need to go to the 
> parent, iterate through the content and remove the element then.
>
> Having something like a number for the position of an element stored in 
> the element as well might ease up quite many things but I  fear this is 
> out of the simplicity of JDOM.

The disadvantage of having number in children is when you do the 
modification on the parent you also have to iterate through the children 
to update their number in the list, so you haven't gained anything in 
this case.

Cheers,
   -- Sébastien.




More information about the jdom-interest mailing list