org.apache.fop.layoutmgr

## Class BreakingAlgorithm.KnuthNode

- java.lang.Object
- - org.apache.fop.layoutmgr.BreakingAlgorithm.KnuthNode

- Enclosing class:
    BreakingAlgorithm

      public class BreakingAlgorithm.KnuthNode
      extends Object

  Class recording all the informations of a feasible breaking point.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `double` | `adjustRatio` adjustment ratio if the line ends at this breakpoint
    `int` | `availableShrink` available stretch of the line ending at this breakpoint
    `int` | `availableStretch` available shrink of the line ending at this breakpoint
    `int` | `difference` difference between target and actual line width
    `int` | `fitness` fitness class of the line ending at this breakpoint.
    `int` | `fitRecoveryCounter` Holds the number of subsequent recovery attempty that are made to get content fit into a line.
    `int` | `line` number of the line ending at this breakpoint
    `BreakingAlgorithm.KnuthNode` | `next` next possible node in the same line
    `int` | `position` index of the breakpoint represented by this node
    `BreakingAlgorithm.KnuthNode` | `previous` best node for the preceding breakpoint
    `double` | `totalDemerits` minimum total demerits up to this breakpoint
    `int` | `totalShrink` accumulated shrinkability of the KnuthElements up to after this breakpoint.
    `int` | `totalStretch` accumulated stretchability of the KnuthElements up to after this breakpoint.
    `int` | `totalWidth` accumulated width of the KnuthElements up to after this breakpoint.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KnuthNode(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)` Construct node.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### position

          public final int position

      index of the breakpoint represented by this node

    - #### line

          public final int line

      number of the line ending at this breakpoint

    - #### fitness

          public final int fitness

      fitness class of the line ending at this breakpoint. One of 0, 1, 2, 3.

    - #### totalWidth

          public final int totalWidth

      accumulated width of the KnuthElements up to after this breakpoint.

    - #### totalStretch

          public final int totalStretch

      accumulated stretchability of the KnuthElements up to after this breakpoint.

    - #### totalShrink

          public final int totalShrink

      accumulated shrinkability of the KnuthElements up to after this breakpoint.

    - #### adjustRatio

          public final double adjustRatio

      adjustment ratio if the line ends at this breakpoint

    - #### availableShrink

          public final int availableShrink

      available stretch of the line ending at this breakpoint

    - #### availableStretch

          public final int availableStretch

      available shrink of the line ending at this breakpoint

    - #### difference

          public final int difference

      difference between target and actual line width

    - #### totalDemerits

          public double totalDemerits

      minimum total demerits up to this breakpoint

    - #### previous

          public BreakingAlgorithm.KnuthNode previous

      best node for the preceding breakpoint

    - #### next

          public BreakingAlgorithm.KnuthNode next

      next possible node in the same line

    - #### fitRecoveryCounter

          public int fitRecoveryCounter

      Holds the number of subsequent recovery attempty that are made to get content fit into a line.

  - ### Constructor Detail

    - #### KnuthNode

          public KnuthNode(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)

      Construct node.
      Parameters:
        `position` - an integer
        `line` - an integer
        `fitness` - an integer
        `totalWidth` - an integer
        `totalStretch` - an integer
        `totalShrink` - an integer
        `adjustRatio` - a real number
        `availableShrink` - an integer
        `availableStretch` - an integer
        `difference` - an integer
        `totalDemerits` - a real number
        `previous` - a node

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2025 Apache Software Foundation. All rights reserved.