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
- Direct Known Subclasses:
FuncPtg,FuncVarPtg
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
- Author:
- Avik Sengupta, Andrew C. Oliver (acoliver at apache dot org)
-
Field Summary
FieldsFields inherited from class org.apache.poi.ss.formula.ptg.OperationPtg
TYPE_BINARY, TYPE_FUNCTION, TYPE_UNARYFields inherited from class org.apache.poi.ss.formula.ptg.Ptg
CLASS_ARRAY, CLASS_REF, CLASS_VALUE, EMPTY_PTG_ARRAY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractFunctionPtg(int functionIndex, int pReturnClass, byte[] paramTypes, int nParams) -
Method Summary
Modifier and TypeMethodDescriptionbytefinal shortfinal StringgetName()final intThe number of operands expected by the operationsfinal bytegetParameterClass(int index) abstract intgetSize()final booleanstatic booleanisBuiltInFunctionName(String name) Used to detect whether a function name found in a formula is one of the standard excel functionsfinal booleanexternal functions get some special processingprotected static shortlookupIndex(String name) Resolves internal function names into function indexes.protected final StringlookupName(short index) final Stringreturn a string representation of this token alonetoFormulaString(String[] operands) returns a string representation of the operations the length of the input array should equal the number returned byfinal StringtoString()Overridden toString method to ensure object hash is not printed.Methods inherited from class org.apache.poi.ss.formula.ptg.Ptg
createPtg, doesFormulaReferToDeletedCell, getEncodedSize, getEncodedSizeWithoutArrayData, getPtgClass, getRVAType, readTokens, serializePtgs, setClass, write
-
Field Details
-
FUNCTION_NAME_IF
The name of the IF function (i.e. "IF"). Extracted as a constant for clarity.- See Also:
-
-
Constructor Details
-
AbstractFunctionPtg
protected AbstractFunctionPtg(int functionIndex, int pReturnClass, byte[] paramTypes, int nParams)
-
-
Method Details
-
isBaseToken
public final boolean isBaseToken()- Specified by:
isBaseTokenin classPtg- Returns:
falseif this token is classified as 'reference', 'value', or 'array'
-
toString
Description copied from class:PtgOverridden toString method to ensure object hash is not printed. This helps get rid of gratuitous diffs when comparing two dumps Subclasses may output more relevant information by overriding this method -
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
-
isExternalFunction
public final boolean isExternalFunction()external functions get some special processing- Returns:
trueif this is an external function
-
toFormulaString
Description copied from class:Ptgreturn a string representation of this token alone- Specified by:
toFormulaStringin classPtg
-
toFormulaString
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:
-
getSize
public abstract int getSize() -
isBuiltInFunctionName
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
-
lookupIndex
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)
-