KnuthElement (Apache FOP 2.7 API)
Date: 2022-01-12

org.apache.fop.layoutmgr

## Class KnuthElement

- java.lang.Object
- - org.apache.fop.layoutmgr.ListElement
  - - org.apache.fop.layoutmgr.KnuthElement

- Direct Known Subclasses:
    KnuthBox, KnuthGlue, KnuthPenalty

      public abstract class KnuthElement
      extends ListElement

  This is the super class for KnuthBox, KnuthGlue and KnuthPenalty. It stores information common to all sub classes, and the methods to get it: the width, a Position and a boolean marking KnuthElements used for some special feature (for example, the additional elements used to represent a space when text alignment is right, left or center).

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `INFINITE` The value used as an infinite indicator.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `KnuthElement(int width, Position pos, boolean auxiliary)` Creates a new `KnuthElement`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getPenalty()`
    `int` | `getShrink()`
    `int` | `getStretch()`
    `int` | `getWidth()`
    `boolean` | `isAuxiliary()`
    `boolean` | `isUnresolvedElement()`

    - ### Methods inherited from class org.apache.fop.layoutmgr.ListElement

      `getLayoutManager, getPosition, isBox, isForcedBreak, isGlue, isPenalty, setPosition`

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

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

- - ### Field Detail

    - #### INFINITE

          public static final int INFINITE

      The value used as an infinite indicator.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### KnuthElement

          protected KnuthElement(int width,
                                 Position pos,
                                 boolean auxiliary)

      Creates a new `KnuthElement`.
      Parameters:
        `width` - the width of this element
        `pos` - the Position stored in this element
        `auxiliary` - is this an auxiliary element?

  - ### Method Detail

    - #### isAuxiliary

          public boolean isAuxiliary()

      Returns:
        true if this element is an auxiliary one.

    - #### getWidth

          public int getWidth()

      Returns:
        the width of this element.

    - #### getPenalty

          public int getPenalty()

      Returns:
        the penalty value of this element, if applicable.

    - #### getStretch

          public int getStretch()

      Returns:
        the stretch value of this element, if applicable.

    - #### getShrink

          public int getShrink()

      Returns:
        the shrink value of this element, if applicable.

    - #### isUnresolvedElement

          public boolean isUnresolvedElement()

      Overrides:
        `isUnresolvedElement` in class `ListElement`
      Returns:
        true if the element is an unresolved element such as a space or a border.

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