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

org.apache.fop.fo.expr

## Interface Function

- All Known Implementing Classes:
    AbsFunction, BodyStartFunction, FromNearestSpecifiedValueFunction, FromParentFunction, FromTableColumnFunction, FunctionBase, InheritedPropFunction, LabelEndFunction, MaxFunction, MinFunction, OCAColorFunction, ProportionalColumnWidthFunction

      public interface Function

  Interface for managing XSL-FO Functions

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `Property` | `eval(Property[] args, PropertyInfo pi)` Evaluate the function
    `Property` | `getOptionalArgDefault(int index, PropertyInfo pi)`
    `int` | `getOptionalArgsCount()`
    `PercentBase` | `getPercentBase()`
    `int` | `getRequiredArgsCount()`
    `boolean` | `hasVariableArgs()` Determine if function allows variable arguments.

- - ### Method Detail

    - #### getRequiredArgsCount

          int getRequiredArgsCount()

      Returns:
        the number of required (non-optional) arguments that must be specified in the argument list

    - #### getOptionalArgsCount

          int getOptionalArgsCount()

      Returns:
        the number of non-required (optional) arguments that may be specified in the argument list, which, if specified, must follow the required arguments

    - #### getOptionalArgDefault

          Property getOptionalArgDefault(int index,
                                         PropertyInfo pi)
                                  throws PropertyException

      Parameters:
        `index` - of optional argument
        `pi` - property information instance that applies to property being evaluated
      Returns:
        the default property value for the optional argument at INDEX, where INDEX is with respect to optional arguments; i.e., the first optional argument position is index 0; if no default for a given index, then null is returned
      Throws:
        `PropertyException` - if index is greater than or equal to optional args count

    - #### hasVariableArgs

          boolean hasVariableArgs()

      Determine if function allows variable arguments. If it does, then they must appear after required and optional arguments, and all optional arguments must be specified.
      Returns:
        true if function permits additional variable number of arguments after required and (completely specified) optional arguments

    - #### getPercentBase

          PercentBase getPercentBase()

      Returns:
        the basis for percentage calculations

    - #### eval

          Property eval(Property[] args,
                        PropertyInfo pi)
                 throws PropertyException

      Evaluate the function
      Parameters:
        `args` - an array of Properties that should be evaluated
        `pi` - property information instance that applies to property being evaluated
      Returns:
        the Property satisfying the function
      Throws:
        `PropertyException` - for problems when evaluating the function

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