Package org.apache.poi.ss.formula.ptg
Class AbstractFunctionPtg
- java.lang.Object
-
- org.apache.poi.ss.formula.ptg.Ptg
-
- org.apache.poi.ss.formula.ptg.OperationPtg
-
- org.apache.poi.ss.formula.ptg.AbstractFunctionPtg
-
- All Implemented Interfaces:
Serializable,Duplicatable,GenericRecord
- Direct Known Subclasses:
FuncPtg,FuncVarPtg
public abstract class AbstractFunctionPtg extends OperationPtg
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- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFUNCTION_NAME_IFThe name of the IF function (i.e.-
Fields inherited from class org.apache.poi.ss.formula.ptg.OperationPtg
TYPE_BINARY, TYPE_FUNCTION, TYPE_UNARY
-
Fields inherited from class org.apache.poi.ss.formula.ptg.Ptg
CLASS_ARRAY, CLASS_REF, CLASS_VALUE, EMPTY_PTG_ARRAY
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFunctionPtg(int functionIndex, int pReturnClass, byte[] paramTypes, int nParams)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description bytegetDefaultOperandClass()shortgetFunctionIndex()Map<String,Supplier<?>>getGenericProperties()StringgetName()intgetNumberOfOperands()The number of operands expected by the operationsbytegetParameterClass(int index)booleanisBaseToken()static booleanisBuiltInFunctionName(String name)Used to detect whether a function name found in a formula is one of the standard excel functionsbooleanisExternalFunction()external functions get some special processingprotected static shortlookupIndex(String name)Resolves internal function names into function indexes.protected StringlookupName(short index)protected StringlookupName(short index, boolean isCetab)StringtoFormulaString()return a string representation of this token aloneStringtoFormulaString(String[] operands)returns a string representation of the operations the length of the input array should equal the number returned byStringtoInternalFormulaString(String[] operands)-
Methods inherited from class org.apache.poi.ss.formula.ptg.Ptg
copy, createPtg, createPtg, doesFormulaReferToDeletedCell, getEncodedSize, getEncodedSize, getEncodedSizeWithoutArrayData, getEncodedSizeWithoutArrayData, getPtgClass, getRVAType, getSid, getSize, readTokens, readTokens, serializePtgs, serializePtgs, setClass, toString, write
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren, getGenericRecordType
-
-
-
-
Field Detail
-
FUNCTION_NAME_IF
public static final String FUNCTION_NAME_IF
The name of the IF function (i.e. "IF"). Extracted as a constant for clarity.- See Also:
- Constant Field Values
-
-
Method Detail
-
isBaseToken
public final boolean isBaseToken()
- Specified by:
isBaseTokenin classPtg- Returns:
falseif this token is classified as 'reference', 'value', or 'array'
-
getFunctionIndex
public final short getFunctionIndex()
-
getNumberOfOperands
public final int getNumberOfOperands()
Description copied from class:OperationPtgThe number of operands expected by the operations- Specified by:
getNumberOfOperandsin classOperationPtg
-
getName
public final String getName()
-
isExternalFunction
public final boolean isExternalFunction()
external functions get some special processing- Returns:
trueif this is an external function
-
toFormulaString
public final String toFormulaString()
Description copied from class:Ptgreturn a string representation of this token alone- Specified by:
toFormulaStringin classPtg
-
toFormulaString
public String toFormulaString(String[] operands)
Description copied from class:OperationPtgreturns a string representation of the operations the length of the input array should equal the number returned by- Specified by:
toFormulaStringin classOperationPtg- See Also:
OperationPtg.getNumberOfOperands()
-
toInternalFormulaString
public String toInternalFormulaString(String[] operands)
- Overrides:
toInternalFormulaStringin classOperationPtg
-
isBuiltInFunctionName
public static boolean isBuiltInFunctionName(String name)
Used to detect whether a function name found in a formula is one of the standard excel functionsThe name matching is case insensitive.
- Returns:
trueif the name specifies a standard worksheet function,falseif the name should be assumed to be an external function.
-
lookupName
protected String lookupName(short index)
-
lookupName
protected final String lookupName(short index, boolean isCetab)
-
lookupIndex
protected static short lookupIndex(String name)
Resolves internal function names into function indexes.The name matching is case insensitive.
- Returns:
- the standard worksheet function index if found, otherwise
FUNCTION_INDEX_EXTERNAL
-
getDefaultOperandClass
public byte getDefaultOperandClass()
- Overrides:
getDefaultOperandClassin classOperationPtg
-
getParameterClass
public final byte getParameterClass(int index)
-
getGenericProperties
public Map<String,Supplier<?>> getGenericProperties()
- Specified by:
getGenericPropertiesin interfaceGenericRecord- Overrides:
getGenericPropertiesin classOperationPtg
-
-