FileDocCategorySizeDatePackage
FuncPtg.javaAPI DocApache Poi 3.0.13651Mon Jan 01 12:39:40 GMT 2007org.apache.poi.hssf.record.formula

FuncPtg

public class FuncPtg extends AbstractFunctionPtg
author
aviks
author
Jason Height (jheight at chariot dot net dot au)
author
Danny Mui (dmui at apache dot org) (Leftover handling)

Fields Summary
public static final byte
sid
public static final int
SIZE
private int
numParams
Constructors Summary
private FuncPtg()
FuncPtgs are defined to be 4 bytes but the actual FuncPtg uses only 2 bytes. If we have leftOvers that are read from the file we should serialize them back out.

If the leftovers are removed, a prompt "Warning: Data may have been lost occurs in Excel"

    
                                                         
	//protected byte[] leftOvers = null;
    
      
      //Required for clone methods      
    
public FuncPtg(RecordInputStream in)
Creates new function pointer from a byte array usually called while reading an excel file.

        //field_1_num_args = data[ offset + 0 ];
        field_2_fnc_index  = in.readShort();
        
      /*  
        if (data.length - offset > 2) { //save left overs if there are any
			leftOvers = new byte[2];
        	System.arraycopy(data, offset+1, leftOvers, 0, leftOvers.length);
        }
        */	
        try {
            numParams = ( (Integer)functionData[field_2_fnc_index][2]).intValue();
        } catch (NullPointerException npe) {
            numParams=0;
        }   
        
    
Methods Summary
public java.lang.Objectclone()

      FuncPtg ptg = new FuncPtg();
      //ptg.field_1_num_args = field_1_num_args;
      ptg.field_2_fnc_index = field_2_fnc_index;
      ptg.setClass(ptgClass);
     return ptg;
    
public intgetNumberOfOperands()

        return numParams;
    
public intgetSize()

        return SIZE;
    
public java.lang.StringtoString()

        StringBuffer buffer = new StringBuffer();
        buffer
        .append("<FunctionPtg>").append("\n")
        .append("   numArgs(internal)=").append(this.numParams).append("\n")
        .append("      name         =").append(lookupName(field_2_fnc_index)).append("\n")
        .append("   field_2_fnc_index=").append(field_2_fnc_index).append("\n")
        .append("</FunctionPtg>");
        return buffer.toString();
    
public voidwriteBytes(byte[] array, int offset)

        array[offset+0]= (byte) (sid + ptgClass);
        //array[offset+1]=field_1_num_args;
        LittleEndian.putShort(array,offset+1,field_2_fnc_index);
        /**if (leftOvers != null) {
        	System.arraycopy(leftOvers, 0, array, offset+2, leftOvers.length);
        }**/