org.apache.fop.fo.properties

## Class PercentLength

- java.lang.Object
- - org.apache.fop.fo.properties.Property
  - - org.apache.fop.fo.properties.LengthProperty
    - - org.apache.fop.fo.properties.PercentLength

- All Implemented Interfaces:
    Length, Numeric

      public class PercentLength
      extends LengthProperty

  a percent specified length quantity in XSL

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.fop.fo.properties.LengthProperty

      `LengthProperty.Maker`

  - ### Field Summary

    - ### Fields inherited from class org.apache.fop.fo.properties.Property

      `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PercentLength(double factor, PercentBase lbase)` Main constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `PercentBase` | `getBaseLength()`
    `double` | `getNumericValue()` Return the value of this Numeric
    `double` | `getNumericValue(PercentBaseContext context)` Return the value of this Numeric
    `protected double` | `getPercentage()` Used during property resolution to check for negative percentages
    `java.lang.String` | `getString()` This method expects to be overridden by subclasses.
    `int` | `getValue()` Return the length of this PercentLength.
    `int` | `getValue(PercentBaseContext context)` Returns the length in 1/1000ths of a point (millipoints)
    `int` | `hashCode()`
    `boolean` | `isAbsolute()` Return false because percent-length are always relative.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.apache.fop.fo.properties.LengthProperty

      `getDimension, getLength, getNumeric, getObject`

    - ### Methods inherited from class org.apache.fop.fo.properties.Property

      `getCharacter, getColor, getCondLength, getEnum, getKeep, getLengthPair, getLengthRange, getList, getNCname, getNumber, getSpace, getSpecifiedValue, isAuto, setSpecifiedValue`

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

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

    - ### Methods inherited from interface org.apache.fop.datatypes.Numeric

      `getEnum`

- - ### Constructor Detail

    - #### PercentLength

          public PercentLength(double factor,
                               PercentBase lbase)

      Main constructor. Construct an object based on a factor (the percent, as a factor) and an object which has a method to return the Length which provides the "base" for the actual length that is modeled.
      Parameters:
        `factor` - the percentage factor, expressed as a decimal (e.g. use .95 to represent 95%)
        `lbase` - base property to which the factor should be applied

  - ### Method Detail

    - #### getBaseLength

          public PercentBase getBaseLength()

      Returns:
        the base

    - #### getPercentage

          protected double getPercentage()

      Used during property resolution to check for negative percentages
      Returns:
        the percentage value

    - #### isAbsolute

          public boolean isAbsolute()

      Return false because percent-length are always relative. Return true if the numeric is an absolute value. Relative values are percentages and table-column-units. All other numerics are absolute.
      Returns:
        true when the numeric is absolute.

    - #### getNumericValue

          public double getNumericValue()

      Return the value of this Numeric
      Returns:
        the computed value.

    - #### getNumericValue

          public double getNumericValue(PercentBaseContext context)

      Return the value of this Numeric
      Parameters:
        `context` - The context for the length calculation (for percentage based lengths)
      Returns:
        the computed value.

    - #### getString

          public java.lang.String getString()

      This method expects to be overridden by subclasses.
      Overrides:
        `getString` in class `Property`
      Returns:
        String property value

    - #### getValue

          public int getValue()

      Return the length of this PercentLength. Returns the length in 1/1000ths of a point (millipoints)
      Returns:
        the length in millipoints

    - #### getValue

          public int getValue(PercentBaseContext context)

      Returns the length in 1/1000ths of a point (millipoints)
      Parameters:
        `context` - The context for the length calculation (for percentage based lengths)
      Returns:
        the length in millipoints

    - #### toString

          public java.lang.String toString()

      Description copied from class: `Property`
      Overrides:
        `toString` in class `Property`
      Returns:
        the String equivalent of this

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

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