On Wednesday, August 13, 2003, at 10:38 PM, Jim Witte wrote:


Moving the sections around isn't much of a problem - I just copy a character range A and put it at point C, then delete the original range (so I don't have to keep track of what C becomes after I delete range A). But then I'd have to recalculate all the values of the start and end points of the sections.

To simplify recalculation of sections, consider the removal of a section and its insertion as two operations. One causes all value pairs above an index to be decreased by a constant amount. The other causes all value pairs above an index to be increased by a constant amount. Yet, those can be generalized into one kind of operation that is performed twice. This means lots of math for lots of sections, but that may not be two bad. (see add)


If there are many sections, then it may not be so bad to come up with a more efficient method for recalculating start and end points of sections.

Any better ideas than these?

Another approach would be to keep the actual sections (not ranges) in arrays. You need an operation that breaks up the text into sections and puts each section into an array element. The array is indexed by section name or some convenient number or other designator. The order of the elements as eventually used is determined by a list. Moving sections means moves lines in that list. You need a fast method to generate the final text from the list and array.


A variation on that, since you are already working with start and end points, is to keep start and end points of the original text in the list. The publishing/preview function takes the original text and the reordering list and creates the new text.

Dar Scott

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to