On Mon, Jul 17, 2006 at 02:08:54PM +0200, Finn Bock wrote: > Vincent Hennebert wrote: > >I'm currently cleaning up and documenting my code, and I think the > >handling of the activeLines array may be simplified: currently, for a > >line l, activeLines[2*l] points to the first active node for this line, > >and activeLines[2*l+1] points to the last node. But the last node is > >never directly accessed, only by starting at the first one and following > >the links. > > Perhaps I misunderstand your question, but I think the last active node > in a line is used when adding yet another active node for that line at > the end of the linked list. In BreakingAlgorithm:addNode(): > > activeLines[headIdx + 1].next = node; > > On the other hand, a different data structure of nodes might very well > open up different improvement. The current structure of using a linked > list for each line, is just the best I could come up with at the time.
In my own implementation I use Java Collections, a list of lists. Once the active nodes have been separated by line number, there is no reason to preserve any remaining order. Simon -- Simon Pepping home page: http://www.leverkruid.eu