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
-
public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm
This is a the breaking algorithm that is responsible for balancing columns in multi-column layout.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classBalancingColumnBreakingAlgorithm.ColumnContent-
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
Fields Modifier and Type Field Description private intcolumnCountprivate java.util.List<java.lang.Integer>idealBreaks-
Fields 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
Constructors Constructor Description BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private intcalcContentLength(KnuthSequence par, int startIndex, int endIndex)private java.util.List<java.lang.Integer>calculateIdealBreaks(int startPos)protected doublecomputeDemerits(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 intgetAverageColumnLength(java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> columns)private java.util.List<java.lang.Integer>getElementIdBreaks(java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks, int startPos)private java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent>getInitialBreaks(int startIndex, int averageColLength)private intgetNextStartIndex(int breakIndex)private intgetPenaltyWidth(int index)private java.util.LinkedList<java.lang.Integer>getPossibilityTrail(BreakingAlgorithm.KnuthNode activeNode)private booleanisLegalBreak(int index, boolean prevIsBox)private java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent>sortElementsForBreaks(java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks)-
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
-
-
-
-
Constructor Detail
-
BalancingColumnBreakingAlgorithm
public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingAlgorithm.PageBreakingLayoutListener layoutListener, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount)
-
-
Method Detail
-
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:
computeDemeritsin 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
private java.util.List<java.lang.Integer> calculateIdealBreaks(int startPos)
-
getAverageColumnLength
private int getAverageColumnLength(java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> columns)
-
getInitialBreaks
private java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> getInitialBreaks(int startIndex, int averageColLength)
-
getNextStartIndex
private int getNextStartIndex(int breakIndex)
-
sortElementsForBreaks
private java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> sortElementsForBreaks(java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks)
-
isLegalBreak
private boolean isLegalBreak(int index, boolean prevIsBox)
-
calcContentLength
private int calcContentLength(KnuthSequence par, int startIndex, int endIndex)
-
getPenaltyWidth
private int getPenaltyWidth(int index)
-
getElementIdBreaks
private java.util.List<java.lang.Integer> getElementIdBreaks(java.util.List<BalancingColumnBreakingAlgorithm.ColumnContent> breaks, int startPos)
-
getPossibilityTrail
private java.util.LinkedList<java.lang.Integer> getPossibilityTrail(BreakingAlgorithm.KnuthNode activeNode)
-
-