*/
if (lastLines != 0
&& (conditionalOptionalLines > 0 || conditionalEliminableLines > 0)) {
breaker.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
breaker.add(new KnuthGlue(0, -conditionalOptionalLines * constantLineHeight,
-conditionalEliminableLines * constantLineHeight,
Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false));
breaker.add(new KnuthPenalty(conditionalOptionalLines * constantLineHeight,
0, false, elementPosition, false));
breaker.add(new KnuthGlue(0, conditionalOptionalLines * constantLineHeight,
conditionalEliminableLines * constantLineHeight,
Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false));
} else if (lastLines != 0) {
breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false));
}
//log.debug("first=" + firstLines + " inner=" + innerLines
// + " optional=" + optionalLines + " eliminable=" + eliminableLines
// + " last=" + lastLines
// + " (condOpt=" + conditionalOptionalLines + " condEl=" + conditionalEliminableLines + ")");
// creation of the elements:
// first group of lines
list.add(new KnuthBox(firstLines * constantLineHeight, elementPosition,
(lastLines == 0
&& conditionalOptionalLines == 0
&& conditionalEliminableLines == 0)));
if (conditionalOptionalLines > 0
|| conditionalEliminableLines > 0) {
list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
list.add(new KnuthGlue(0, conditionalOptionalLines * constantLineHeight,
conditionalEliminableLines * constantLineHeight,
Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false));
list.add(new KnuthBox(0, elementPosition, (lastLines == 0)));
}
// optional lines
for (int i = 0; i < optionalLines; i++) {
list.addAll(breaker);
list.add(new KnuthBox(0, elementPosition, false));
list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
list.add(new KnuthGlue(0, constantLineHeight, 0,
Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false));
list.add(new KnuthBox(0, elementPosition, false));
}
// eliminable lines
for (int i = 0; i < eliminableLines; i++) {
list.addAll(breaker);
list.add(new KnuthBox(constantLineHeight, elementPosition, false));
list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
list.add(new KnuthGlue(0, 0, constantLineHeight,
Adjustment.LINE_NUMBER_ADJUSTMENT, elementPosition, false));
list.add(new KnuthBox(0, elementPosition, false));
}
// inner lines