breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false));
}
// 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
for (int i = 0; i < innerLines; i++) {
list.addAll(breaker);
list.add(new KnuthBox(constantLineHeight, elementPosition, false));
}
// last group of lines
if (lastLines > 0) {
list.addAll(breaker);
list.add(new KnuthBox(lastLines * constantLineHeight,
elementPosition, true));
}
}