1    package org.apache.poi.hssf.record.formula;
2    import org.apache.poi.util.LittleEndian;
3    
4    public class FuncPtg extends AbstractFunctionPtg{
5        
6        public final static byte sid  = 0x21;
7        private int numParams=0;
8        /**Creates new function pointer from a byte array 
9         * usually called while reading an excel file. 
10        */
11       public FuncPtg(byte[] data, int offset) {
12           offset++;
13           //field_1_num_args = data[ offset + 0 ];
14           field_2_fnc_index  = LittleEndian.getShort(data,offset + 0 );
15           try {
16               numParams = ( (Integer)functionData[field_2_fnc_index][2]).intValue();
17           } catch (NullPointerException npe) {
18               numParams=0;
19           }   
20       }
21       
22        public void writeBytes(byte[] array, int offset) {
23           array[offset+0]= (byte) (sid + ptgClass);
24           //array[offset+1]=field_1_num_args;
25           LittleEndian.putShort(array,offset+1,field_2_fnc_index);
26       }
27       
28        public int getNumberOfOperands() {
29           return numParams;
30       }
31   }