I have tried to removed the double-list return type (a list of KnuthSequences) of InlineLevelLM.getNextKnuthElements. I have abandoned those efforts.
If the return type is only a single list, the call stack has to return to LineLM.getNextKnuthElements for every completed paragraph and every sequence of block elements. This is certainly possible, and was the case in the past. It is true that most paragraphs consist of only one Knuth paragraph, and do not contain block content. For those paragraphs a single list return type would be efficient. It would require look-ahead: Can the next sequence of Knuth elements be appended to this one? And caching the sequence if not. Probably not a big deal. Nevertheless, I do not feel inspired to code this only for sake of the return type. Having an inherited method with a list with different types of content elements will be a problem when we would ever use type-safe collections. I would prefer to tackle this by defining a return type KnuthSequences, which would be able to hold a single KnuthSequence or a list of KnuthSequences, with logic to handle both cases transparently for its clients. I thought you may wish to know these considerations. Simon -- Simon Pepping home page: http://www.leverkruid.nl
