1 16 17 18 package org.apache.poi.hssf.record.formula; 19 import org.apache.poi.util.LittleEndian; 20 21 26 public class FuncPtg extends AbstractFunctionPtg{ 27 28 public final static byte sid = 0x21; 29 public final static int SIZE = 3; 30 private int numParams=0; 31 32 38 40 private FuncPtg() { 41 } 43 44 47 public FuncPtg(byte[] data, int offset) { 48 offset++; 49 field_2_fnc_index = LittleEndian.getShort(data,offset + 0 ); 51 52 58 try { 59 numParams = ( (Integer )functionData[field_2_fnc_index][2]).intValue(); 60 } catch (NullPointerException npe) { 61 numParams=0; 62 } 63 64 } 65 66 public void writeBytes(byte[] array, int offset) { 67 array[offset+0]= (byte) (sid + ptgClass); 68 LittleEndian.putShort(array,offset+1,field_2_fnc_index); 70 73 } 74 75 public int getNumberOfOperands() { 76 return numParams; 77 } 78 79 public Object clone() { 80 FuncPtg ptg = new FuncPtg(); 81 ptg.field_2_fnc_index = field_2_fnc_index; 83 ptg.setClass(ptgClass); 84 return ptg; 85 } 86 87 public int getSize() { 88 return SIZE; 89 } 90 91 public String toString() { 92 StringBuffer buffer = new StringBuffer (); 93 buffer 94 .append("<FunctionPtg>").append("\n") 95 .append(" numArgs(internal)=").append(this.numParams).append("\n") 96 .append(" name =").append(lookupName(field_2_fnc_index)).append("\n") 97 .append(" field_2_fnc_index=").append(field_2_fnc_index).append("\n") 98 .append("</FunctionPtg>"); 99 return buffer.toString(); 100 } 101 } | Popular Tags |