On Jun 1, 2008, at 03:40, Peter B. West wrote:

Andreas Delmelle wrote:
On May 29, 2008, at 18:23, Vincent Hennebert wrote:
Could anybody explain me what is the purpose of the following piece of
code:
    if (!breakBeforeServed) {
        try {
if (addKnuthElementsForBreakBefore(returnList, context)) {
                return returnList;
            }
        } finally {
            breakBeforeServed = true;
        }
    }
that we can find, for instance, in BlockStackingLM.getNextKnuthElements?
Can't explain, other than that it seems to be a remnant of some refactoring cycle without subsequential cleanup...


Isn’t it equivalent to the following:
    if (!breakBeforeServed) {
        breakBeforeServed = true;
        if (addKnuthElementsForBreakBefore(returnList, context)) {
            return returnList;
        }
    }
Indeed, this has the exact same outcome AFAICT.

What's the scope of breakBeforeServed?

Protected instance member. On top of that, the method call addKnuthElementsForBreakBefore() can only throw an Exception in case adding elements to the passed List would fail for some reason, and the value for breakBeforeServed is definitely not used in that method (otherwise there would be a good reason why it's set only after the call).


Cheers

Andreas


Reply via email to