List of usage examples for org.apache.poi.ss.formula.ptg FuncVarPtg getNumberOfOperands
public final int getNumberOfOperands()
From source file:org.tiefaces.components.websheet.utility.ShiftFormulaUtility.java
License:MIT License
/** * Single ptg./* www . ja v a 2 s. co m*/ * * @param ptg * the ptg * @param originalOperandClass * the original operand class * @param formulaChanged * the formula changed * @return the ptg[] */ private static Ptg[] singlePtg(final Object ptg, final byte originalOperandClass, final int formulaChanged) { Ptg[] newPtg = new Ptg[1]; if (originalOperandClass != (-1)) { ((Ptg) ptg).setClass(originalOperandClass); } Object ptgAfter = ptg; if (ptg instanceof FuncVarPtg) { FuncVarPtg fptg = (FuncVarPtg) ptg; if ((formulaChanged > 0) && (fptg.getNumberOfOperands() != formulaChanged)) { ptgAfter = FuncVarPtg.create(((FuncVarPtg) ptg).getName(), formulaChanged); } } newPtg[0] = (Ptg) ptgAfter; return newPtg; }