Jeremias Maerki wrote:

AbstractBreaker has maybe two or three methods in common with
LayoutManager. Furthermore, I see the Breaker as something else than a
layout manager. I think it would be confusing to merge the two concepts.
The duplicate methods can probably be moved up to the base class.



I've been looking again at the code--I think I agree with you now. I like how the breakers accumulate all of the breaker-specific methods in one place in the class. It is cleaner (compared to having them mixed within the LM classes), and the code is actually quite efficiently written already.


As for possible duplicate methods such as getNextKnuthElements()--which is apparently different between the Breaker and the LM in some cases anyway--I notice that we already have a getTopLevelLM() which returns the LM getting processed. Where duplication occurs, we can just reference the method from there (i.e., getTopLevelLM().methodInTheLMClass()).

If helpful, we may also want to create more specialized LayoutManager interfaces (e.g., BreakableLM extending LayoutManager), and then have certain LM's implement it in addition to whatever they already extend. If we do that, then we'll have:

BreakableLM getTopLevelLM();

instead to call those only-a-few-LM's-have methods. But I currently don't see any need to alter the Breaker classes themselves.

Thanks,
Glen




Reply via email to