org.apache.fop.datatypes

## Interface Numeric

- All Known Subinterfaces:
    Length
  All Known Implementing Classes:
    EnumLength, EnumNumber, FixedLength, LengthProperty, NumberProperty, NumericProperty, PercentLength, RelativeNumericProperty, TableColLength

      public interface Numeric

  An interface for classes that can participate in numeric operations. All the numeric operation (+, -, *, ...) are expressed in terms of this Numeric interface. Numerics has a value (getNumericValue) and a dimension (getDimension). Numerics can be either absolute or relative. Relative numerics must be resolved against base value before the value can be used.

  To support relative numerics internally in the expression parser and during evaluation one additional methods exists: isAbsolute() which return true for absolute numerics and false for relative numerics.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDimension()` Return the dimension of this numeric.
    `int` | `getEnum()` Return the enum value that is stored in this numeric.
    `double` | `getNumericValue()` Return the value of this Numeric
    `double` | `getNumericValue(PercentBaseContext context)` Return the value of this Numeric
    `int` | `getValue()` Returns the value of this numeric as an int.
    `int` | `getValue(PercentBaseContext context)` Returns the value of this numeric as an int.
    `boolean` | `isAbsolute()` Return true if the numeric is an absolute value.

- - ### Method Detail

    - #### getNumericValue

          double getNumericValue()

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

    - #### getNumericValue

          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.

    - #### getDimension

          int getDimension()

      Return the dimension of this numeric. Plain numbers has a dimension of 0 and length has a dimension of 1. Other dimension can occur as a result of multiplications and divisions.
      Returns:
        the dimension.

    - #### isAbsolute

          boolean isAbsolute()

      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.

    - #### getValue

          int getValue()

      Returns the value of this numeric as an int.
      Returns:
        the value as an integer.

    - #### getValue

          int getValue(PercentBaseContext context)

      Returns the value of this numeric as an int.
      Parameters:
        `context` - the context for the length calculation (for percentage based lengths)
      Returns:
        the value as an integer.

    - #### getEnum

          int getEnum()

      Return the enum value that is stored in this numeric.
      Returns:
        the enum value

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