src/org/tiefaces/components/websheet/utility/ShiftFormulaUtility.java
private static Ptg[] convertPtg(final Ptg[] ptgs, final int position,
			final ShiftFormulaRef shiftFormulaRef, final Object ptg) {

		byte originalOperandClass = -1;

		if (!((Ptg) ptg).isBaseToken()) {
			originalOperandClass = ((Ptg) ptg).getPtgClass();
		}

		int currentRow;
		currentRow = getFirstSupportedRowNumFromPtg(ptg);
		if ((currentRow >= 0)
				&& shiftFormulaRef.getWatchList().contains(currentRow)) {
			return convertPtgForWatchList(ptgs, position, shiftFormulaRef,
					ptg, originalOperandClass, currentRow);

		}
		// no need change ptg
		if ((ptg instanceof AttrPtg)
				&& (shiftFormulaRef.getFormulaChanged() > 1)) {
			AttrPtg newPtg = (AttrPtg) ptg;
			if (newPtg.isSum()) {
				FuncVarPtg fptg = FuncVarPtg.create("sum",
						shiftFormulaRef.getFormulaChanged());
				return singlePtg(fptg, fptg.getPtgClass(),
						shiftFormulaRef.getFormulaChanged());
			}
		}
		return singlePtg(ptg, originalOperandClass,
				shiftFormulaRef.getFormulaChanged());

	}
private static Ptg[] convertPtg(final Ptg[] ptgs, final int position,
			final ShiftFormulaRef shiftFormulaRef, final Object ptg) {

		byte originalOperandClass = -1;

		if (!((Ptg) ptg).isBaseToken()) {
			originalOperandClass = ((Ptg) ptg).getPtgClass();
		}

		int currentRow;
		currentRow = getFirstSupportedRowNumFromPtg(ptg);
		if ((currentRow >= 0)
				&& shiftFormulaRef.getWatchList().contains(currentRow)) {
			return convertPtgForWatchList(ptgs, position, shiftFormulaRef,
					ptg, originalOperandClass, currentRow);

		}
		// no need change ptg
		if ((ptg instanceof AttrPtg)
				&& (shiftFormulaRef.getFormulaChanged() > 1)) {
			AttrPtg newPtg = (AttrPtg) ptg;
			if (newPtg.isSum()) {
				FuncVarPtg fptg = FuncVarPtg.create("sum",
						shiftFormulaRef.getFormulaChanged());
				return singlePtg(fptg, fptg.getPtgClass(),
						shiftFormulaRef.getFormulaChanged());
			}
		}
		return singlePtg(ptg, originalOperandClass,
				shiftFormulaRef.getFormulaChanged());

	}
private static Ptg [ ] convertPtg ( final Ptg [ ] ptgs , final int position , final ShiftFormulaRef shiftFormulaRef , final Object ptg ) { byte originalOperandClass = - 1 ; if ( ! ( ( Ptg ) ptg ) . isBaseToken ( ) ) { originalOperandClass = ( ( Ptg ) ptg ) . getPtgClass ( ) ; } int currentRow ; currentRow = getFirstSupportedRowNumFromPtg ( ptg ) ; if ( ( currentRow >= 0 ) && shiftFormulaRef . getWatchList ( ) . contains ( currentRow ) ) { return convertPtgForWatchList ( ptgs , position , shiftFormulaRef , ptg , originalOperandClass , currentRow ) ; } // no need change ptg
 if ( ( ptg instanceof AttrPtg ) && ( shiftFormulaRef . getFormulaChanged ( ) > 1 ) ) { AttrPtg newPtg = ( AttrPtg ) ptg ; if ( newPtg . isSum ( ) ) { FuncVarPtg fptg = FuncVarPtg . create ( "sum" , shiftFormulaRef . getFormulaChanged ( ) ) ; return singlePtg ( fptg , fptg . getPtgClass ( ) , shiftFormulaRef . getFormulaChanged ( ) ) ; } } return singlePtg ( ptg , originalOperandClass , shiftFormulaRef . getFormulaChanged ( ) ) ; }
Convert ptg.

@param ptgs
the ptgs
@param position
the position
@param shiftFormulaRef
the shift formula ref
@param ptg
the ptg
@return the ptg[]
Convert ptg .