Class BalancingColumnBreakingAlgorithm


  • public class BalancingColumnBreakingAlgorithm
    extends PageBreakingAlgorithm
    This is a the breaking algorithm that is responsible for balancing columns in multi-column layout.
    • Field Detail

      • columnCount

        private int columnCount
      • idealBreaks

        private java.util.List<java.lang.Integer> idealBreaks
    • 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:
        computeDemerits in class PageBreakingAlgorithm
        Parameters:
        activeNode - considered preceding line break
        element - considered current line break
        fitnessClass - fitness of the current line
        r - adjustment ratio for the current line
        Returns:
        the demerit of the current line
      • calculateIdealBreaks

        private java.util.List<java.lang.Integer> calculateIdealBreaks​(int startPos)
      • getNextStartIndex

        private int getNextStartIndex​(int breakIndex)
      • isLegalBreak

        private boolean isLegalBreak​(int index,
                                     boolean prevIsBox)
      • calcContentLength

        private int calcContentLength​(KnuthSequence par,
                                      int startIndex,
                                      int endIndex)
      • getPenaltyWidth

        private int getPenaltyWidth​(int index)
      • getPossibilityTrail

        private java.util.LinkedList<java.lang.Integer> getPossibilityTrail​(BreakingAlgorithm.KnuthNode activeNode)