org.apache.fop.layoutmgr
public class BalancingColumnBreakingAlgorithm extends BreakingAlgorithm
| Modifier and Type | Class and Description |
|---|---|
static interface |
PageBreakingAlgorithm.PageBreakingLayoutListener
Interface to notify about layout events during page breaking.
|
BreakingAlgorithm.BestRecords, BreakingAlgorithm.KnuthNodeactiveLines, activeNodeCount, alignment, alignmentLast, ALL_BREAKS, best, bFirst, considerTooShort, endLine, incompatibleFitnessDemerit, INFINITE_RATIO, lineWidth, maxFlaggedPenaltiesCount, NO_FLAGGED_PENALTIES, ONLY_FORCED_BREAKS, par, repeatedFlaggedDemerit, startLine, totalShrink, totalStretch, totalWidth| Constructor and Description |
|---|
BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
PageProvider pageProvider,
PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener,
int alignment,
int alignmentLast,
MinOptMax footnoteSeparatorLength,
boolean partOverflowRecovery,
int columnCount) |
| Modifier and Type | Method and Description |
|---|---|
protected double |
computeAdjustmentRatio(BreakingAlgorithm.KnuthNode activeNode,
int difference)
Return the adjust ration needed to make up for the difference.
|
protected double |
computeDemerits(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int fitnessClass,
double r)
Computes the demerits of the current breaking (that is, up to the given element),
if the next-to-last chosen breakpoint is the given active node.
|
protected int |
computeDifference(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int elementIndex)
Return the difference between the natural width of a line that would be made
between the given active node and the given element, and the available width of the
real line.
|
protected void |
considerLegalBreak(KnuthElement element,
int elementIdx)
Determines if the given breakpoint is a feasible breakpoint.
|
protected BreakingAlgorithm.KnuthNode |
createNode(int position,
int line,
int fitness,
int totalWidth,
int totalStretch,
int totalShrink)
Creates a new active node for a break from the best active node of the given
fitness class to the element at the given position.
|
protected BreakingAlgorithm.KnuthNode |
createNode(int position,
int line,
int fitness,
int totalWidth,
int totalStretch,
int totalShrink,
double adjustRatio,
int availableShrink,
int availableStretch,
int difference,
double totalDemerits,
BreakingAlgorithm.KnuthNode previous)
Creates a new active node for a feasible breakpoint at the given position.
|
protected int |
filterActiveNodes() |
protected void |
finish() |
FObj |
getFObj() |
java.util.LinkedList |
getFootnoteList(int index) |
protected int |
getLineWidth(int line)
Returns the line/part width of a given line/part.
|
java.util.LinkedList |
getPageBreaks() |
protected void |
handleBox(KnuthBox box)
Page-breaking specific handling of the given box.
|
protected void |
initialize()
Resets the algorithm's variables.
|
void |
insertPageBreakAsFirst(AbstractBreaker.PageBreakPosition pageBreak) |
void |
removeAllPageBreaks()
Removes all page breaks from the result list.
|
protected int |
restartFrom(BreakingAlgorithm.KnuthNode restartingNode,
int currentIndex) |
void |
updateData1(int total,
double demerits)
Empty method, hook for subclasses.
|
void |
updateData2(BreakingAlgorithm.KnuthNode bestActiveNode,
KnuthSequence sequence,
int total)
Empty method, hook for subclasses.
|
addNode, compareNodes, findBreakingPoints, findBreakingPoints, getAlignment, getAlignmentLast, getElement, getLineWidth, getMaxRecoveryAttempts, getNode, isPartOverflowRecoveryActivated, removeNode, setConstantLineWidth, toStringpublic BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount)
protected double computeDemerits(BreakingAlgorithm.KnuthNode activeNode, KnuthElement element, int fitnessClass, double r)
activeNode - considered preceding line breakelement - considered current line breakfitnessClass - fitness of the current liner - adjustment ratio for the current lineprotected void initialize()
BreakingAlgorithminitialize in class BreakingAlgorithmprotected BreakingAlgorithm.KnuthNode createNode(int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink, double adjustRatio, int availableShrink, int availableStretch, int difference, double totalDemerits, BreakingAlgorithm.KnuthNode previous)
BreakingAlgorithmcreateNode in class BreakingAlgorithmposition - index of the element in the Knuth sequenceline - number of the line ending at the breakpointfitness - fitness class of the line ending at the breakpoint. One of 0, 1, 2, 3.totalWidth - accumulated width of the KnuthElements up to after the breakpointtotalStretch - accumulated stretchability of the KnuthElements up to after the
breakpointtotalShrink - accumulated shrinkability of the KnuthElements up to after the
breakpointadjustRatio - adjustment ratio if the line ends at this breakpointavailableShrink - available stretch of the line ending at this breakpointavailableStretch - available shrink of the line ending at this breakpointdifference - difference between target and actual line widthtotalDemerits - minimum total demerits up to the breakpointprevious - active node for the preceding breakpointprotected BreakingAlgorithm.KnuthNode createNode(int position, int line, int fitness, int totalWidth, int totalStretch, int totalShrink)
BreakingAlgorithmprotected void handleBox(KnuthBox box)
handleBox in class BreakingAlgorithmbox - a block-level element possibly containing foonotes citationsprotected int restartFrom(BreakingAlgorithm.KnuthNode restartingNode, int currentIndex)
restartFrom in class BreakingAlgorithmprotected void considerLegalBreak(KnuthElement element, int elementIdx)
BreakingAlgorithmconsiderLegalBreak in class BreakingAlgorithmelement - the paragraph's element to considerelementIdx - the element's index inside the paragraphprotected int computeDifference(BreakingAlgorithm.KnuthNode activeNode, KnuthElement element, int elementIndex)
BreakingAlgorithmcomputeDifference in class BreakingAlgorithmactiveNode - node for the previous breakpointelement - currently considered breakpointprotected double computeAdjustmentRatio(BreakingAlgorithm.KnuthNode activeNode, int difference)
BreakingAlgorithmcomputeAdjustmentRatio in class BreakingAlgorithmprotected void finish()
finish in class BreakingAlgorithmpublic java.util.LinkedList getPageBreaks()
public void insertPageBreakAsFirst(AbstractBreaker.PageBreakPosition pageBreak)
public void removeAllPageBreaks()
public void updateData1(int total,
double demerits)
BreakingAlgorithmupdateData1 in class BreakingAlgorithmtotal - number of lines for the active nodedemerits - total demerits of the paragraph for the active nodepublic void updateData2(BreakingAlgorithm.KnuthNode bestActiveNode, KnuthSequence sequence, int total)
BreakingAlgorithmupdateData2 in class BreakingAlgorithmbestActiveNode - a node in the chain of best active nodes, corresponding to
one of the optimal breakpointssequence - the corresponding paragraphtotal - the number of lines into which the paragraph will be brokenBreakingAlgorithm.calculateBreakPoints(KnuthNode, KnuthSequence, int)protected int filterActiveNodes()
filterActiveNodes in class BreakingAlgorithmpublic java.util.LinkedList getFootnoteList(int index)
public FObj getFObj()
protected int getLineWidth(int line)
getLineWidth in class BreakingAlgorithmline - the line/part numberCopyright 1999-2008 The Apache Software Foundation. All Rights Reserved.