fop 0.91beta

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.


Inner classes inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm
BreakingAlgorithm.BestRecords, BreakingAlgorithm.KnuthNode
 
Fields inherited from class org.apache.fop.layoutmgr.BreakingAlgorithm
activeLines, activeNodeCount, alignment, alignmentLast, ALL_BREAKS, best, bFirst, considerTooShort, endLine, incompatibleFitnessDemerit, INFINITE_RATIO, lastDeactivatedNode, lineWidth, log, maxFlaggedPenaltiesCount, NO_FLAGGED_PENALTIES, ONLY_FORCED_BREAKS, par, repeatedFlaggedDemerit, startLine, totalShrink, totalStretch, totalWidth
 
Constructor Summary
BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageSequenceLayoutManager.PageViewportProvider pvProvider, int alignment, int alignmentLast, MinOptMax footnoteSeparatorLength, boolean partOverflowRecovery, int columnCount)
           
 
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()
           
 FObj getFObj()
           
 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
 

Constructor Detail

BalancingColumnBreakingAlgorithm

public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM,
                                        PageSequenceLayoutManager.PageViewportProvider pvProvider,
                                        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)
Overrides:
computeDemerits in class org.apache.fop.layoutmgr.PageBreakingAlgorithm
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
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)
Overrides:
updateData1 in class BreakingAlgorithm

updateData2

public void updateData2(BreakingAlgorithm.KnuthNode bestActiveNode,
                        KnuthSequence sequence,
                        int total)
Overrides:
updateData2 in class BreakingAlgorithm

filterActiveNodes

protected int filterActiveNodes()
Overrides:
filterActiveNodes in class BreakingAlgorithm

getFootnoteList

public java.util.LinkedList getFootnoteList(int index)

getFObj

public FObj getFObj()
Returns:
the associated top-level formatting object.

getLineWidth

protected int getLineWidth(int line)
Overrides:
getLineWidth in class BreakingAlgorithm
See Also:
BreakingAlgorithm.getLineWidth(int)

fop 0.91beta

Copyright 1999-2005 The Apache Software Foundation. All Rights Reserved.