org.apache.fop.layoutmgr
Class BalancingColumnBreakingAlgorithm
java.lang.Object
org.apache.fop.layoutmgr.BreakingAlgorithm
org.apache.fop.layoutmgr.PageBreakingAlgorithm
org.apache.fop.layoutmgr.BalancingColumnBreakingAlgorithm
- public class BalancingColumnBreakingAlgorithm
- extends org.apache.fop.layoutmgr.PageBreakingAlgorithm
This is a the breaking algorithm that is responsible for balancing columns in multi-column
layout.
Fields inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm |
activeLines, activeNodeCount, alignment, alignmentLast, ALL_BREAKS, best, bFirst, considerTooShort, endLine, incompatibleFitnessDemerit, INFINITE_RATIO, lastDeactivatedNode, lineWidth, NO_FLAGGED_PENALTIES, ONLY_FORCED_BREAKS, par, repeatedFlaggedDemerit, startLine, totalShrink, totalStretch, totalWidth |
Method Summary |
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)
|
protected int |
computeDifference(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int elementIndex)
Return the difference between the line width and the width of the break that
ends in 'element'. |
protected void |
considerLegalBreak(KnuthElement element,
int elementIdx)
|
protected BreakingAlgorithm.KnuthNode |
createNode(int position,
int line,
int fitness,
int totalWidth,
int totalStretch,
int totalShrink)
|
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)
|
protected int |
filterActiveNodes()
|
protected void |
finish()
|
java.util.LinkedList |
getFootnoteList(int index)
|
protected int |
getLineWidth(int line)
|
java.util.LinkedList |
getPageBreaks()
|
protected void |
handleBox(KnuthBox box)
|
protected void |
initialize()
|
void |
insertPageBreakAsFirst(AbstractBreaker.PageBreakPosition pageBreak)
|
protected void |
removeNode(int line,
BreakingAlgorithm.KnuthNode node)
Remove the first node in line 'line'. |
protected int |
restartFrom(BreakingAlgorithm.KnuthNode restartingNode,
int currentIndex)
|
void |
updateData1(int total,
double demerits)
|
void |
updateData2(BreakingAlgorithm.KnuthNode bestActiveNode,
KnuthSequence sequence,
int total)
|
Methods inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm |
addNode, compareNodes, findBreakingPoints, findBreakingPoints, getAdjustRatio, getDifference, getElement, getEnd, getLineWidth, getMaxRecoveryAttempts, getNode, getStart, isPartOverflowRecoveryActivated, setConstantLineWidth, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BalancingColumnBreakingAlgorithm
public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
PageSequenceLayoutManager.PageViewportProvider pvProvider,
int alignment,
int alignmentLast,
MinOptMax footnoteSeparatorLength,
boolean partOverflowRecovery,
int columnCount)
computeDemerits
protected double computeDemerits(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int fitnessClass,
double r)
- See Also:
BreakingAlgorithm
initialize
protected void initialize()
- Overrides:
initialize
in class BreakingAlgorithm
createNode
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)
- Overrides:
createNode
in class BreakingAlgorithm
createNode
protected BreakingAlgorithm.KnuthNode createNode(int position,
int line,
int fitness,
int totalWidth,
int totalStretch,
int totalShrink)
- Overrides:
createNode
in class BreakingAlgorithm
handleBox
protected void handleBox(KnuthBox box)
- Overrides:
handleBox
in class BreakingAlgorithm
restartFrom
protected int restartFrom(BreakingAlgorithm.KnuthNode restartingNode,
int currentIndex)
- Overrides:
restartFrom
in class BreakingAlgorithm
considerLegalBreak
protected void considerLegalBreak(KnuthElement element,
int elementIdx)
- Overrides:
considerLegalBreak
in class BreakingAlgorithm
computeDifference
protected int computeDifference(BreakingAlgorithm.KnuthNode activeNode,
KnuthElement element,
int elementIndex)
- Return the difference between the line width and the width of the break that
ends in 'element'.
- Overrides:
computeDifference
in class BreakingAlgorithm
- Parameters:
activeNode
- element
- elementIndex
-
- Returns:
- The difference in width. Positive numbers mean extra space in the line,
negative number that the line overflows.
computeAdjustmentRatio
protected double computeAdjustmentRatio(BreakingAlgorithm.KnuthNode activeNode,
int difference)
- Return the adjust ration needed to make up for the difference. A ratio of
- 0 means that the break has the exact right width
- >= -1 && < 0 means that the break is to wider than the line,
but within the minimim values of the glues.
- >0 && < 1 means that the break is smaller than the line width,
but within the maximum values of the glues.
- > 1 means that the break is too small to make up for the glues.
- Overrides:
computeAdjustmentRatio
in class BreakingAlgorithm
- Parameters:
activeNode
- difference
-
- Returns:
- The ration.
finish
protected void finish()
- Overrides:
finish
in class BreakingAlgorithm
removeNode
protected void removeNode(int line,
BreakingAlgorithm.KnuthNode node)
- Remove the first node in line 'line'. If the line then becomes empty, adjust the
startLine accordingly.
- Overrides:
removeNode
in class BreakingAlgorithm
- Parameters:
line
- node
-
getPageBreaks
public java.util.LinkedList getPageBreaks()
insertPageBreakAsFirst
public void insertPageBreakAsFirst(AbstractBreaker.PageBreakPosition pageBreak)
updateData1
public void updateData1(int total,
double demerits)
- Specified by:
updateData1
in class BreakingAlgorithm
updateData2
public void updateData2(BreakingAlgorithm.KnuthNode bestActiveNode,
KnuthSequence sequence,
int total)
- Specified by:
updateData2
in class BreakingAlgorithm
filterActiveNodes
protected int filterActiveNodes()
- Specified by:
filterActiveNodes
in class BreakingAlgorithm
getFootnoteList
public java.util.LinkedList getFootnoteList(int index)
getLineWidth
protected int getLineWidth(int line)
- Overrides:
getLineWidth
in class BreakingAlgorithm
- See Also:
BreakingAlgorithm.getLineWidth(int)
Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.