Top Description Fields Constructors Methods
org.apache.poi.ss.formula.ptg

public abstract Class AbstractFunctionPtg

extends OperationPtg
Class Inheritance
Known Direct Subclasses
org.apache.poi.ss.formula.ptg.FuncPtg, org.apache.poi.ss.formula.ptg.FuncVarPtg
Imports
java.util.Locale, .Map, java.util.function.Supplier, org.apache.poi.ss.formula.function.FunctionMetadata, .FunctionMetadataRegistry, org.apache.poi.util.GenericRecordUtil

This class provides the base functionality for Excel sheet functions There are two kinds of function Ptgs - tFunc and tFuncVar Therefore, this class will have ONLY two subclasses

Field Summary

Modifier and TypeField and Description
private final short
private final int
private static final short
FUNCTION_INDEX_EXTERNAL

All external functions have function index 255

public static final String
FUNCTION_NAME_IF

The name of the IF function (i.e. "IF").

private final byte[]
private final byte
Inherited from org.apache.poi.ss.formula.ptg.OperationPtg:
TYPE_BINARYTYPE_FUNCTIONTYPE_UNARY

Constructor Summary

AccessConstructor and Description
protected
AbstractFunctionPtg(int functionIndex, int pReturnClass, byte[] paramTypes, int nParams)

Method Summary

Modifier and TypeMethod and Description
private static void
appendArgs(StringBuilder buf, int firstArgIx, String[] operands)

public byte
public final short
public Map<String, Supplier<?>>
public final String
public final int
getNumberOfOperands()

Implements abstract org.apache.poi.ss.formula.ptg.OperationPtg.getNumberOfOperands.

The number of operands expected by the operations

public final byte
getParameterClass(int index)

public abstract int
public final boolean
public static boolean

Returns:

true if the name specifies a standard worksheet function, false if the name should be assumed to be an external function.
isBuiltInFunctionName
(String name)

Used to detect whether a function name found in a formula is one of the standard excel functions

The name matching is case insensitive.

public final boolean

Returns:

true if this is an external function
isExternalFunction
()

external functions get some special processing

protected static short

Returns:

the standard worksheet function index if found, otherwise FUNCTION_INDEX_EXTERNAL
lookupIndex
(String name)

Resolves internal function names into function indexes.

protected String
lookupName(short index)

protected final String
lookupName(short index, boolean isCetab)

public final String
toFormulaString()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.toFormulaString.

return a string representation of this token alone

public String
toFormulaString(String[] operands)

Implements abstract org.apache.poi.ss.formula.ptg.OperationPtg.toFormulaString.

returns a string representation of the operations the length of the input array should equal the number returned by

Field Detail

_functionIndexback to summary
private final short _functionIndex
_numberOfArgsback to summary
private final int _numberOfArgs
FUNCTION_INDEX_EXTERNALback to summary
private static final short FUNCTION_INDEX_EXTERNAL

All external functions have function index 255

FUNCTION_NAME_IFback to summary
public static final String FUNCTION_NAME_IF

The name of the IF function (i.e. "IF"). Extracted as a constant for clarity.

paramClassback to summary
private final byte[] paramClass
returnClassback to summary
private final byte returnClass

Constructor Detail

AbstractFunctionPtgback to summary
protected AbstractFunctionPtg(int functionIndex, int pReturnClass, byte[] paramTypes, int nParams)

Method Detail

appendArgsback to summary
private static void appendArgs(StringBuilder buf, int firstArgIx, String[] operands)
getDefaultOperandClassback to summary
public byte getDefaultOperandClass()

Overrides org.apache.poi.ss.formula.ptg.OperationPtg.getDefaultOperandClass.

Annotations
@Override
getFunctionIndexback to summary
public final short getFunctionIndex()
getGenericPropertiesback to summary
public Map<String, Supplier<?>> getGenericProperties()

Overrides org.apache.poi.ss.formula.ptg.OperationPtg.getGenericProperties.

Implements org.apache.poi.common.usermodel.GenericRecord.getGenericProperties.

Annotations
@Override
getNameback to summary
public final String getName()
getNumberOfOperandsback to summary
public final int getNumberOfOperands()

Implements abstract org.apache.poi.ss.formula.ptg.OperationPtg.getNumberOfOperands.

Doc from org.apache.poi.ss.formula.ptg.OperationPtg.getNumberOfOperands.

The number of operands expected by the operations

Annotations
@Override
getParameterClassback to summary
public final byte getParameterClass(int index)
getSizeback to summary
public abstract int getSize()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.getSize.

Returns:int

Doc from org.apache.poi.ss.formula.ptg.Ptg.getSize.

the encoded length of this Ptg, including the initial Ptg type identifier byte.

Annotations
@Override
isBaseTokenback to summary
public final boolean isBaseToken()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.isBaseToken.

Returns:boolean

Doc from org.apache.poi.ss.formula.ptg.Ptg.isBaseToken.

false if this token is classified as 'reference', 'value', or 'array'

Annotations
@Override
isBuiltInFunctionNameback to summary
public static boolean isBuiltInFunctionName(String name)

Used to detect whether a function name found in a formula is one of the standard excel functions

The name matching is case insensitive.

Returns:boolean

true if the name specifies a standard worksheet function, false if the name should be assumed to be an external function.

isExternalFunctionback to summary
public final boolean isExternalFunction()

external functions get some special processing

Returns:boolean

true if this is an external function

lookupIndexback to summary
protected static short lookupIndex(String name)

Resolves internal function names into function indexes.

The name matching is case insensitive.

Returns:short

the standard worksheet function index if found, otherwise FUNCTION_INDEX_EXTERNAL

lookupNameback to summary
protected String lookupName(short index)
lookupNameback to summary
protected final String lookupName(short index, boolean isCetab)
toFormulaStringback to summary
public final String toFormulaString()

Implements abstract org.apache.poi.ss.formula.ptg.Ptg.toFormulaString.

Doc from org.apache.poi.ss.formula.ptg.Ptg.toFormulaString.

return a string representation of this token alone

Annotations
@Override
toFormulaStringback to summary
public String toFormulaString(String[] operands)

Implements abstract org.apache.poi.ss.formula.ptg.OperationPtg.toFormulaString.

Doc from org.apache.poi.ss.formula.ptg.OperationPtg.toFormulaString.

returns a string representation of the operations the length of the input array should equal the number returned by

Annotations
@Override