1 2 17 18 19 24 package org.apache.poi.hssf.record.formula; 25 26 import org.apache.poi.util.LittleEndian; 27 import org.apache.poi.hssf.model.Workbook; 28 29 35 36 public class IntPtg 37 extends Ptg 38 { 39 public final static int SIZE = 3; 40 public final static byte sid = 0x1e; 41 private short field_1_value; 42 43 private String val; 44 private int strlen = 0; 45 46 private IntPtg() { 47 } 49 50 public IntPtg(byte [] data, int offset) 51 { 52 setValue(LittleEndian.getShort(data, offset + 1)); 53 } 54 55 56 public IntPtg(String formulaToken) { 58 setValue(Short.parseShort(formulaToken)); 59 } 60 61 public void setValue(short value) 62 { 63 field_1_value = value; 64 } 65 66 public short getValue() 67 { 68 return field_1_value; 69 } 70 71 public void writeBytes(byte [] array, int offset) 72 { 73 array[ offset + 0 ] = sid; 74 LittleEndian.putShort(array, offset + 1, getValue()); 75 } 76 77 public int getSize() 78 { 79 return SIZE; 80 } 81 82 public String toFormulaString(Workbook book) 83 { 84 return "" + getValue(); 85 } 86 public byte getDefaultOperandClass() {return Ptg.CLASS_VALUE;} 87 88 public Object clone() { 89 IntPtg ptg = new IntPtg(); 90 ptg.field_1_value = field_1_value; 91 return ptg; 92 } 93 } 94 | Popular Tags |