Package org.apache.fop.layoutmgr
Class BalancingColumnBreakingAlgorithm
java.lang.Object
org.apache.fop.layoutmgr.BreakingAlgorithm
org.apache.fop.layoutmgr.PageBreakingAlgorithm
org.apache.fop.layoutmgr.BalancingColumnBreakingAlgorithm
This is a the breaking algorithm that is responsible for balancing columns in multi-column
layout.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Nested classes/interfaces inherited from class org.apache.fop.layoutmgr.PageBreakingAlgorithm
PageBreakingAlgorithm.BestPageRecords, PageBreakingAlgorithm.KnuthPageNode, PageBreakingAlgorithm.PageBreakingLayoutListener
Nested classes/interfaces inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm
BreakingAlgorithm.BestRecords, BreakingAlgorithm.FitnessClasses, BreakingAlgorithm.KnuthNode
-
Field Summary
FieldsFields inherited from class org.apache.fop.layoutmgr.PageBreakingAlgorithm
bestNodeForLastPage
Fields inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm
activeLines, activeNodeCount, alignment, alignmentLast, ALL_BREAKS, best, considerTooShort, endLine, incompatibleFitnessDemerit, indentFirstPart, INFINITE_RATIO, lineWidth, maxFlaggedPenaltiesCount, NO_FLAGGED_PENALTIES, ONLY_FORCED_BREAKS, par, repeatedFlaggedDemerit, startLine, totalShrink, totalStretch, totalWidth
-
Constructor Summary
ConstructorsConstructorDescriptionBalancingColumnBreakingAlgorithm
(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
calcContentLength
(KnuthSequence par, int startIndex, int endIndex) calculateIdealBreaks
(int startPos) 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.private int
getElementIdBreaks
(List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks, int startPos) getInitialBreaks
(int startIndex, int averageColLength) private int
getNextStartIndex
(int breakIndex) private int
getPenaltyWidth
(int index) private LinkedList
<Integer> getPossibilityTrail
(BreakingAlgorithm.KnuthNode activeNode) private boolean
isLegalBreak
(int index, boolean prevIsBox) Methods inherited from class org.apache.fop.layoutmgr.PageBreakingAlgorithm
addNode, compareNodes, computeAdjustmentRatio, computeDifference, considerLegalBreak, createForcedNodes, createNode, createNode, deactivateNode, disableFloatHandling, elementCanEndLine, filterActiveNodes, finish, getBestFloatEdgeNode, getBestNodeBeforeIPDChange, getBestNodeForLastPage, getFloatHeight, getFloatPosition, getFObj, getFootnoteList, getIPDdifference, getLineWidth, getPageBreaks, handleBox, handleFloat, handleIpdChange, handlePenaltyAt, handlingEndOfFloat, handlingFloat, handlingStartOfFloat, initialize, insertPageBreakAsFirst, loadFootnotes, recoverFromOverflow, recoverFromTooLong, relayFootnotes, removeAllPageBreaks, restartFrom, updateData1, updateData2
Methods inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm
activateNode, calculateBreakPoints, findBreakingPoints, findBreakingPoints, forceNode, getAlignment, getAlignmentLast, getElement, getLastTooLong, getLastTooShort, getLineWidth, getMaxRecoveryAttempts, getNode, handleElementAt, handleGlueAt, isPartOverflowRecoveryActivated, removeNode, replaceLastDeactivated, setConstantLineWidth, toString
-
Field Details
-
columnCount
private int columnCount -
idealBreaks
-
-
Constructor Details
-
BalancingColumnBreakingAlgorithm
public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount)
-
-
Method Details
-
computeDemerits
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. This adds to the total demerits of the given active node, the demerits of a line starting at this node and ending at the given element.- Overrides:
computeDemerits
in classPageBreakingAlgorithm
- Parameters:
activeNode
- considered preceding line breakelement
- considered current line breakfitnessClass
- fitness of the current liner
- adjustment ratio for the current line- Returns:
- the demerit of the current line
-
calculateIdealBreaks
-
getAverageColumnLength
-
getInitialBreaks
private List<BalancingColumnBreakingAlgorithm.ColumnContent> getInitialBreaks(int startIndex, int averageColLength) -
getNextStartIndex
private int getNextStartIndex(int breakIndex) -
sortElementsForBreaks
private List<BalancingColumnBreakingAlgorithm.ColumnContent> sortElementsForBreaks(List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks) -
isLegalBreak
private boolean isLegalBreak(int index, boolean prevIsBox) -
calcContentLength
-
getPenaltyWidth
private int getPenaltyWidth(int index) -
getElementIdBreaks
private List<Integer> getElementIdBreaks(List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks, int startPos) -
getPossibilityTrail
-