org.foray.fotree.value
Class Function

java.lang.Object
  extended by org.foray.fotree.value.Expr
      extended by org.foray.fotree.value.ExprAdditive
          extended by org.foray.fotree.value.ExprMultiplicative
              extended by org.foray.fotree.value.ExprUnary
                  extended by org.foray.fotree.value.ExprPrimary
                      extended by org.foray.fotree.value.Function
All Implemented Interfaces:
PropertyValue
Direct Known Subclasses:
FnAbs, FnAbstractNamedProperty, FnBodyStart, FnCeiling, FnFloor, FnFromTableColumn, FnLabelEnd, FnMax, FnMin, FnProportionalColWidth, FnRgb, FnRgbIcc, FnRound, FnSystemColor, FnSystemFont

public abstract class Function
extends ExprPrimary

Abstract superclass for all XSL-FO functions.


Field Summary
static byte ABS
          Constant indicating the "abs" function.
static byte BODY_START
          Constant indicating the "body-start" function.
static byte CEILING
          Constant indicating the "ceiling" function.
static byte FLOOR
          Constant indicating the "floor" function.
static byte FROM_NEAREST_SPECIFIED_VALUE
          Constant indicating the "from-nearest-specified-value" function.
static byte FROM_PAGE_MASTER_REGION
          Constant indicating the "from-page-master-region" function.
static byte FROM_PARENT
          Constant indicating the "from-parent" function.
static byte FROM_TABLE_COLUMN
          Constant indicating the "from-table-column" function.
static String[] FUNCTION_NAME_LIST
          The array of valid function names.
static byte INHERITED_PROPERTY_VALUE
          Constant indicating the "inheritied-property-value" function.
static byte LABEL_END
          Constant indicating the "label-end" function.
static byte MAX
          Constant indicating the "max" function.
static byte MERGE_PROPERTY_VALUES
          Constant indicating the "merge-property-values" function.
static byte MIN
          Constant indicating the "min" function.
static byte PROPORTIONAL_COLUMN_WIDTH
          Constant indicating the "proportional-column-width" function.
static byte RGB
          Constant indicating the "rgb" function.
static byte RGB_ICC
          Constant indicating the "rgb-icc" function.
static byte ROUND
          Constant indicating the "round" function.
static byte SYSTEM_COLOR
          Constant indicating the "system-color" function.
static byte SYSTEM_FONT
          Constant indicating the "system-font" function.
 
Fields inherited from class org.foray.fotree.value.Expr
OPERATION_ADD, OPERATION_DIVIDE, OPERATION_MOD, OPERATION_MULTIPLY, OPERATION_NEGATION, OPERATION_SUBTRACT, UNIT_POWER_AREA, UNIT_POWER_LENGTH, UNIT_POWER_NON_NUMERIC, UNIT_POWER_NUMERIC
 
Constructor Summary
Function()
          Constructor.
 
Method Summary
static byte enumerateFunctionName(String functionName)
          Converts a function name to its integral equivalent.
abstract  String getFunctionName()
          Return the name of this function.
protected  void invalidParameters()
          Throws an exception indicating that the parameters are invalid.
static Function makeFunction(int functionType, Expr[] arguments, PropertyType propertyType)
          Factory method for the various function types.
protected  void validateNoArguments(Expr[] arguments)
          Validates that this function has no arguments, and throws an exception if it does.
protected  DtName validateNoneOrOneName(Expr[] arguments)
          Validates that this function either 1) has no arguments, or 2) has exactly one argument and that a Name.
 
Methods inherited from class org.foray.fotree.value.Expr
evalColorException, evalIntegerException, evalKeywordException, evalLengthException, evalNumericException, evalPercentageException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.foray.fotree.value.PropertyValue
canEvalColor, canEvalInteger, canEvalKeyword, canEvalLength, canEvalNumeric, canEvalPercentage, evalColor, evalInteger, evalKeyword, evalLength, evalNumeric, evalPercentage, getUnitPower, lengthRequiresFontSize
 

Field Detail

FUNCTION_NAME_LIST

public static final String[] FUNCTION_NAME_LIST
The array of valid function names.


ABS

public static final byte ABS
Constant indicating the "abs" function.

See Also:
Constant Field Values

BODY_START

public static final byte BODY_START
Constant indicating the "body-start" function.

See Also:
Constant Field Values

CEILING

public static final byte CEILING
Constant indicating the "ceiling" function.

See Also:
Constant Field Values

FLOOR

public static final byte FLOOR
Constant indicating the "floor" function.

See Also:
Constant Field Values

FROM_NEAREST_SPECIFIED_VALUE

public static final byte FROM_NEAREST_SPECIFIED_VALUE
Constant indicating the "from-nearest-specified-value" function.

See Also:
Constant Field Values

FROM_PAGE_MASTER_REGION

public static final byte FROM_PAGE_MASTER_REGION
Constant indicating the "from-page-master-region" function.

See Also:
Constant Field Values

FROM_PARENT

public static final byte FROM_PARENT
Constant indicating the "from-parent" function.

See Also:
Constant Field Values

FROM_TABLE_COLUMN

public static final byte FROM_TABLE_COLUMN
Constant indicating the "from-table-column" function.

See Also:
Constant Field Values

INHERITED_PROPERTY_VALUE

public static final byte INHERITED_PROPERTY_VALUE
Constant indicating the "inheritied-property-value" function.

See Also:
Constant Field Values

LABEL_END

public static final byte LABEL_END
Constant indicating the "label-end" function.

See Also:
Constant Field Values

MAX

public static final byte MAX
Constant indicating the "max" function.

See Also:
Constant Field Values

MERGE_PROPERTY_VALUES

public static final byte MERGE_PROPERTY_VALUES
Constant indicating the "merge-property-values" function.

See Also:
Constant Field Values

MIN

public static final byte MIN
Constant indicating the "min" function.

See Also:
Constant Field Values

PROPORTIONAL_COLUMN_WIDTH

public static final byte PROPORTIONAL_COLUMN_WIDTH
Constant indicating the "proportional-column-width" function.

See Also:
Constant Field Values

RGB

public static final byte RGB
Constant indicating the "rgb" function.

See Also:
Constant Field Values

RGB_ICC

public static final byte RGB_ICC
Constant indicating the "rgb-icc" function.

See Also:
Constant Field Values

ROUND

public static final byte ROUND
Constant indicating the "round" function.

See Also:
Constant Field Values

SYSTEM_COLOR

public static final byte SYSTEM_COLOR
Constant indicating the "system-color" function.

See Also:
Constant Field Values

SYSTEM_FONT

public static final byte SYSTEM_FONT
Constant indicating the "system-font" function.

See Also:
Constant Field Values
Constructor Detail

Function

public Function()
Constructor.

Method Detail

invalidParameters

protected void invalidParameters()
                          throws PropertyException
Throws an exception indicating that the parameters are invalid.

Throws:
PropertyException - Always, as that is the purpose of this method.

getFunctionName

public abstract String getFunctionName()
Return the name of this function.

Returns:
One of the enumerated function types, e.g. ABS, LABEL_END, etc.

enumerateFunctionName

public static byte enumerateFunctionName(String functionName)
Converts a function name to its integral equivalent.

Parameters:
functionName - The function name to be enumerated.
Returns:
The enumerated value of the function name.

makeFunction

public static Function makeFunction(int functionType,
                                    Expr[] arguments,
                                    PropertyType propertyType)
                             throws PropertyException
Factory method for the various function types.

Parameters:
functionType - The integral value of the function type.
arguments - The array of arguments to this function.
propertyType - The property which is calling this function.
Returns:
A newly-constructed instance of a FunctionAbstract subclass.
Throws:
PropertyException - For invalid arguments to the function.

validateNoArguments

protected void validateNoArguments(Expr[] arguments)
                            throws PropertyException
Validates that this function has no arguments, and throws an exception if it does.

Parameters:
arguments - The arguments passed to this function.
Throws:
PropertyException - If this function has any arguments.

validateNoneOrOneName

protected DtName validateNoneOrOneName(Expr[] arguments)
                                throws PropertyException
Validates that this function either 1) has no arguments, or 2) has exactly one argument and that a Name. Throws an exception otherwise.

Parameters:
arguments - The arguments passed to this function.
Returns:
The Name instance if any, or null otherwise.
Throws:
PropertyException - If this function does not meet the stated requirements.


Copyright © 2017. All rights reserved.